I am making a battleship program in graphwin and I have been trying to gifure out how to make cells in a The Cell class has the following methods:
* constructor that takes a row, column, and value and create a new object at that position
* getRow: returns the value of the row field
* getColumn: returns the value of the column field
* getValue: returns the value of the value field
* getRectangle: returns a reference to its rectangle field
* setNextValue: that takes a value
* update: change a Cell's value to its next value and update its color
Grid class:
* numRows(): returns the number of rows in the grid
* numCols(): returns the number of columns in the grid
* getValue(row, col): returns the value of the cell at (row, col)
* setNextValue(row, col, val): sets the next value of the cell at (row,col)
* update(): simulates a time step (each Cell's value should be updated to its next value)
* close(): prompt the user to click to close the graphics window
However, I cannot get it to work, how would I organize the code to get it to function?
cells and gridshow to put a cell in a grid
Page 1 of 1
2 Replies - 511 Views - Last Post: 07 December 2010 - 11:16 AM
Replies To: cells and grids
#2
Re: cells and grids
Posted 07 December 2010 - 11:15 AM
Would you mind posting the code you currently have along with a more thorough description of the error (ie do you get actual errors or do you simply not get the output you expected)?
#3
Re: cells and grids
Posted 07 December 2010 - 11:16 AM
You are going to have to demonstrate some sort of effort to get help. Please post your code -- IN CODE TAGS, as shown below -- and we can try to help.
Page 1 of 1
|
|

New Topic/Question
Reply




MultiQuote





|