University of Strasbourg
UFR of mathematics and computer science
Introduction
Copyright By PowCoder代写 加微信 powcoder
Computer architecture Fourth Power Project
Baptiste LAFABREGUE and Tiago TREVISAN JOST 11 f ́evrier 2022
The goal of this project is to implement a small popular game: the power of 4. As a reminder, this game is played by two people, the objective being to be the first player to line up its color, either vertically, horizontally or diagonally. The code will be written in MIPS assembler, and executed using the Mars emulator. The project is to be carried out in pairs, and to be returned before 03/06/2022 at 11:59 p.m. respecting all the specifications given in section 1. The project.zip archive contains:
— this document — the
starting assembly code to complete
1 Sp ́ecifications
Your code will take the form of an .asm file, executable using the Mars4 5 emulator. column (from 1 to 7) where to position the token. The game will end when one of the stopping conditions is met. Figure 1 gives an example of display obtained thanks to the MIPS simulator after a few rounds between the players. The game visualization will correspond to a graphical representation of a segment of static memory, provided by the Mars tools. This part is already implemented.
The rendering will take the form of an archive named Nom1 Nom2.zip, which will contain: the .asm file and a report in .pdf format of a maximum of 2 pages explaining the choices made during the design of your project, your structures data, who did what, difficulties encountered, features added, and other observations that you find useful. This archive will be deposited before 06/03/2022 at 23:59 on the Moodle platform. The rest of this document presents some help on the use of the Mars emulator (section 2), an exhaustive summary of the expected execution (section 3) as well as the functionalities to implement (section 4).
Figure 1 – Sample display
Figure 2 – Configuration de la fenˆetre BitMap Diplay
March 2 and system calls
The Mars emulator is launched from the java Mars4 5.jar archive using the java -jar Mars4 5.jar command. To launch your program, you must load your power 4.asm file. Then you have to activate the display by going to the Tools tab to launch Bitmap Display. In the BitMap Display tool use the configuration as shown in Figure 2, you should select pixel size 16×16 (1), square window 512×512 (2), memory area point e to heap(3). Don’t forget to connect the widget to your MIPS code before assembling it (4).
3 Course of the game
Let’s describe the progress of a power 4 game by analyzing the main game loop:
1. Player X is asked to choose a column to play with a number between 1 and 7.
2. Determine where the token will be located in the column. If no token is present in the column the token is placed on the bottom of the column. Otherwise it is placed above the other tokens.
3. We save the position of the token in memory until the end of the game and we display it in updating the corresponding memory addresses.
4. We see if this last token allowed player X to win. If this is not the case, we check that the grid is not full, otherwise we declare a tie.
5. If player X has won or there is a tie, display it on the console and stop, otherwise the player X becomes the next player and we return to step 1.
4 Work to be provided
The graphic display and refresh functions are already implemented, no modification is to be made in this part of the source code. You must program the following features:
— Determine the position of the token that has just been played — Test if the end-of-game condition is met (victory or a tie).
— Propose in the console to restart a game
Moreover, the code must be commented in order to be able to understand the use of the temporary registers.
The project is considered finished when these specifications are respected. However, to get the maximum score, additional functionality can be added. This can be chosen from those listed below:
— Propose at the start of the game to each player to choose a (different) color from a set offered via the console.
— Display the winning player at the end of the game on the BitMap Display window.
However, another proposed feature can be chosen and will be evaluated as having a complexity with those proposed above (but keep it simple).
Finally, it is forbidden to use the .macro keyword.
The project will be evaluated according to the following scale: — The project compiles (1pts)
— The code is readable and well commented (2pts) — The choice of data structure (1.5pts)
— The calculation of the position is well done (4pts)
— The victory condition is well calculated (6pts)
— The program allows you to restart a game (3pts) — the bonus feature (2.5pts)
程序代写 CS代考 加微信: powcoder QQ: 1823890830 Email: powcoder@163.com