Assignment-1 1
Assignment-1 1
Assignment
BATTLESHIP
Contents
1 Outcomes 2
2 Introduction 2
3 Requirements 3
4 Submission 4
5 Plagiarism 5
1 Outcomes
After finishing this assignment, students can proficiently use:
• Procedures.
2 Introduction
Battleship is a strategic board game between 2 players. It focuses on the
process of planning deducting skill of both players. The game rules can be
found in [1], in summary:
2. After the ships have been positioned, the game proceeds in a series of
rounds. In each round, each player takes a turn to announce a target
3. If all of a player’s ships have been sunk, the game is over and their
opponent wins.
3 Requirements
In this project, we will replicate the battleship game in MIPS assembly
language. Since the resource is limited and to keep things simple, we will
work with a smaller grid size which is 7x7. Please create a program that
does the following:
• We begin with the preparation phase where the players set up their
ship locations. The program should prompt to ask the players to insert
the location of the ships. The values of the cells of the map will be
either 1 or 0. 1 means that the box is occupied by a ship, otherwise
it’s 0. The players will need to setup the exact amount of ships with
the same size in order to complete the setup phase. In detail, each
player will have 3 2x1 ships, 2 3x1 ships, and 1 4x1 ship. Note that
the ships can not overlap with each other. An example of an acceptable
arrangement is shown in Figure 2.
Figure 2: Example of the the ships that a player can place in this project
• After the setup phase, both players will take turn targeting a box on
the other player’s map blindly. If the attack hits a cell that is occupied
by a ship, an announcement should pop up in the terminal and says
”HIT!”. This will allow the attacking player to know if they hit an
opponent’s ship or not. The players will need to remember the cells
that have been hit themselves. If a cell got hit, its value should change
into 0, as there it is no longer occupied by a ship. A ship is completely
destroyed if all of the cells it’s occupying are targeted. A player will
lose if all of their ships got destroyed first. In other words, the game
will end when a player’s board contain only 0’s.
• Note: Bonus points are provided if you can write out the moves of each
player into a separate text file for ease of review.
4 Submission
Students are requested to submit the MIPS program(s)/source code (.asm
files) and the Assignment report to BK E-learning system (BKEL) no later
than the last lab session of your group. Assignment must be done individu-
ally. Students have to demonstrate program(s) on MARS MIPS during the
last lab session. Students who do not show up during the demonstration
time will get 0 for the assignment. The report should not contain code.
Instead, students should present the algorithms as well as the idea in your
implementation.
5 Plagiarism
Similarity less than 30% in MIPS code is allowed. In other words, you
will get 0 for assignment if your answers are similar to another student’s more
than 30%. Note that, we will use the MOSS tool developed by Stanford for
checking similarity (https://theory.stanford.edu/~aiken/moss/).
References
[1] Wikipedia, “Battleship (game).” [Online]. Available: https://en.
wikipedia.org/wiki/Battleship (game)