cells and grids

how to put a cell in a grid

Page 1 of 1

2 Replies - 642 Views - Last Post: 07 December 2010 - 11:16 AM Rate Topic: -----

#1 gill_i  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 4
  • Joined: 30-November 10

cells and grids

Posted 07 December 2010 - 10:56 AM

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?

Is This A Good Question/Topic? 0
  • +

Replies To: cells and grids

#2 atraub  Icon User is offline

  • Pythoneer
  • member icon

Reputation: 759
  • View blog
  • Posts: 2,010
  • Joined: 23-December 08

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)?
Was This Post Helpful? 0
  • +
  • -

#3 JackOfAllTrades  Icon User is offline

  • Saucy!
  • member icon

Reputation: 6052
  • View blog
  • Posts: 23,487
  • Joined: 23-August 08

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.

:code:
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1