200k views
5 votes
As discussed in class the topic for the team project this semester is the Multiplication game.

For a feel of the game visit

Multiplication Game

Note: MARS does not have a graphics capability so ASCII board is sufficient.

Minimum requirements for the program:
The game is for two players: the user v.s. the computer. The numbers in the board do not change (they must be a product of 2 numbers.)
The game board is displayed using ASCII characters (e.g. ., -, +, and |) is the minimum requirement. Creative ways to display the board, e.g. with graphic, will earn the team extra credits.
Implementation of a winning strategy by the computer is NOT required but will earn extra credits if implemented.
All moves by the user and the computer MUST be valid according to the rules of the game.
An error message is displayed to explain the rule that was violated if a move by the user was not valid, e.g., the multiplication result is not on the board.
IMPORTANT: The program must be developed as multiple modules (i.e. multiple .asm files), each module implements one part of the game. If the program is implemented as one file points will be severely deducted.

How would You create Board_display module?

1 Answer

1 vote

Final answer:

To create a Board_display module for a Multiplication game, one must define the board with two-dimensional arrays, initialize and print the game board using ASCII characters, provide logic to update the board, implement error handling for invalid moves, and ensure module interfacing with other parts of the project.

Step-by-step explanation:

To create a Board_display module for a Multiplication game, you can start by understanding the logic of the ASCII board. This board needs to be displayed in a way that's easy to read and understand, using ASCII characters like '.', '-', '+', and '|'. Here's a simplified step-by-step process for creating this module in assembly language:

  • Define the size of the game board, typically a two-dimensional array.
  • Initialize the game board with the products of the multiplication of two numbers.
  • Create a function that will print the game board to the console using ASCII characters.
  • Include logic to update the game board after every valid move, by both the user and the computer.
  • Implement error handling to display a message when the user attempts an invalid move, providing feedback on the rule that was violated.

For example, the board might be initialized as a 2D grid with values that are the product of two numbers between 1 and 9. Each cell in the grid represents a potential move in the game.

When printing the board, iterate through each cell in the array, printing a '|' at the beginning of a new row, and a '.' at the end of each cell. Numbers can be right-justified using spaces to maintain alignment.

After each move, update the board by changing the value of the selected cell to indicate it's been chosen and reprint the board. Ensure your module is capable of interfacing with other modules, such as those handling user input or the computer's move logic. This concept would help in case implementation of a winning strategy is added later for additional credits as indicated in the project requirements.

User Wubbalubba
by
7.3k points