2002 Fall

                                                                                 CIS-1123 Fortran

Dr. Tom Pittman tpittman@sbuniv.edu
Taylor 108, 3p.M-F, 328-1562

SBU policy is that they own the Syllabus; other material is the property of the instructor who prepared it.

Assignments, Due Date, problems:
August 27: p.36, 1,2,5,6
September 3: p.109, 3,11,16,20
September 10: p.127, 18,21,25; p.182, 2
September 17: p.247, 4,7,20,21
October 4: p.319, 3,6,7
October 8: p.409, #5, 12; p.506, #7, 10
October 22: p.604, #3,  4,  10+11
October 31: p.683, #1, 6, 7, 9

Final: Dec.10, 8am
 

Term Program Project: Battleship

Each week until the end of the semester we will hold a tournament between all the student programs playing each other. The play will be scored as follows:
1.  Is the program present and running? No-shows or failure to compile and run without crashing will be severely downgraded.
2.  Does the program play correctly to the end of the game?
3.  How often does the program win over the other programs? Extra credit for winning the tournament.

My  Battleship program
 

Rules:

The game is played on a 9x9 grid. Each side populates its own board with the following five pieces, consisting of the specified number of grid points in a row horizontally or vertically (one each, except there are two PT boats):
5  Battleship
4  Destroyer
3  Cruiser
2  PT Boat (two of these)


A.  Each program begins a turn cycle by displaying its own board and whatever it knows about the opponent board, then waiting for input.

B.  The input is a 3-digit number (three single digit numbers), the first digit reflecting the result of the last output, or zero if none (as with the first turn):

0=No hit
1=Hit
2=Sunk PT Boat
3=Sunk Cruiser
4=Sunk Destroyer
5=Sunk Battleship
9=Game over
The next two digits represent the row and column for the opponent's shot. When the program gets to go first, this will also be zero on the first iteration.

C.  The program will process this input, then output its response in the same format, then go back to Step A to repeat the cycle.

You are encouraged to watch the tournament play and improve your program for the next week's tournament. Program (source code) must be submitted by email at least 30 minutes before class in order to compete. Send your entry to: TPittman@SBUniv.edu
 

Back to T.Pittman home

Rev. 2002 December 6