CSE 115 - Spring 2010 - Banner
UB -
University at Buffalo, The State University of New York Computer Science and Engineering
  • CSE 115 - Spring 2010
CSE 115 - Spring 2010 - Navigation
CSE 115 - Spring 2010 - Announcements

Lab 8

CSE 115 - Spring 2010 - Lab 8

Introduction

It's almost done - the final pieces of Battleship.


Lab Functionality Description

First, you will need to imlplement the left-over functionality from Lab 7 - ships should not be allowed to be placed on top of each other.

Then, you need to implement game play (the actually shooting and sinking of ships).

First, you must set up a board for the computer player. You should place all five ships somewhere on the screen (place them at the same place each time). This can be done right when the game starts or after the player has placed his/her ships.

When the player's ships are on the screen, clicking on the opponents board will look to see if there is a ship at the location clicked. If so, a hit should be displayed and the number of hits remaining should be decremented. When there are no hits left, a message should be displayed indicating that the game is over.

If the player clicks on a place where there is no ship, a miss should be displayed. Clicking on cells that have already been clicked on should display messages indicating that the cells had been clicked on previously.

Extra Credit

Actually making the game alternate turns between the player and the computer. When the computer plays, it can simply select cells at random, but the results (hit or miss) should be displayed just as they are for the player. If you think about this carefully, the computer player can use almost the exact same methods the human player uses to place its hits and misses.

For additional extra credit, you can add a bit more smarts to the computer player.


Lab Tasks

There is no lab skeleton for this assignment. You should build your Lab 8 on top of your Lab 7. If you do not have a functioning Lab 7, then you should stop by in person to one of the staff's office hours and a solution can be mailed to you. No solutions will be given out in recitations or via email requests. If you didn't get your Lab 7 working, you should probably acquaint yourself with office hours.

If you receive a solution to Lab 7, then you need to TAKE THE TIME TO UNDERSTAND the code in the solution before going on to your Lab 8 implementation.


Due dates

You will submit your Lab 8 assignment using the Web-CAT submission plugin from Eclipse. Lab 8 is due for everyone by the end of the day, Monday, April 26th.


CSE 115 - Spring 2010 - Footer

Page maintained by Adrienne Decker

Contact: adrienne@buffalo.edu | 130 Bell Hall | (716)645-3184