ece190_fa10_mp2_rev1 - ECE 190 Introduction to Computing...

Info iconThis preview shows pages 1–3. Sign up to view the full content.

View Full Document Right Arrow Icon
ECE 190: Introduction to Computing Systems, Fall 2010 Machine Problem 2 Checkpoint 1 Due: 5 p.m., Wednesday 6 October, 2010 Checkpoint 1 Due: 5 p.m., Wednesday 13 October, 2010 Battleship Introduction: For this machine problem, you will be writing a program in LC-3 assembly to implement the game of Battleship. Battleship is a guessing game played between two people. Each player has a grid laid out with ships that are hidden from the other player. The players take turns guessing grid locations in an attempt to hit the other person’s ship s. Each ship can take a certain number of hits before being sunk. The game ends when all of one player’s ships have been sunk. Your program will control the flow of the game and alternate taking guesses from each player. You will use ASCII characters to display the 10x10 game boards. Your implementation should be able to display the board, take row and column coordinates as user input, detect if the placement is "legal," and determine when the game is finished. Ship positions will be loaded into memory before your code begins running. A skeleton mp2.asm file and test cases will be provided (read the MP2 README in the Machine Problems section). The skeleton code contains useful constants and the labels of the required subroutines. Checkpoint 1: For the first checkpoint, you will need to correctly display the 10x10 game board. You will be given a database that contains 100 numbers stored sequentially and starting at memory address x4000 . These numbers represent the player’s 10x10 game board. Address Memory Value (column, row) x4000 Cell (0,a) x4001 Cell (1,a) X4002 Cell (2,a) x400A Cell (0,b) x4063 Cell (9,j) Each memory location will have data in the following format: 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 S G Each memory location represents one cell on the grid. Only the bottom two bits are relevant, the rest of the bits are set to 0. The S bit determines whether there is part of a ship in that cell whereas the G bit determines whether the cell has been guessed or not by the player. For example, the bit pattern 0000 0000 0000 0011 indicates that a part of the opponent’s ship is in that cell and the cell has been guessed, so an ‘H’ should be displayed in that cell. Similarly, 0000 0000 0000 0001 indicates a missed guess and so an ‘M’ should be displayed. The other
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
two bit combinations indicate a cell has not been guessed and therefore a blank space should be displayed. Note that the G bit indicates whether the current player has guessed that cell already, while the S bit indicates whether any part of the current player’s OPPONENT’S ships lie in the cell. The 10x10 grid itself shall be rendered using ASCII '+', '-', '|', and ' ' (space) characters as follows: 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 +---+---+---+---+---+---+---+---+---+---+ +---+---+---+---+---+---+---+---+---+---+ a | | | | | | | | | | | a | | | | | | | | | | | +---+---+---+---+---+---+---+---+---+---+
Background image of page 2
Image of page 3
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

Page1 / 5

ece190_fa10_mp2_rev1 - ECE 190 Introduction to Computing...

This preview shows document pages 1 - 3. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online