Grid(int tempWidth, int tempHeight): creates a Grid full of Squares with appropriate width and height
getMember(int x, int y): returns a pointer to the Square at (x, y)
expandTop(), expandRight(), expandBottom(), expandLeft() or expand(compass direction) where compass is an enum: adds a row or column to the side of the Grid specified. This will be calls when the robot moves beyond the current bounds of the Grid
I'm thinking that Square's pointers in the 4 directions should remain private, but Square should be declared a friend class of Grid.
I think the best way for Grid to keep track of the Squares is to have a pointer to the Square at (0, 0).
Class
Grid
requirements (feel free to refine):Grid(int tempWidth, int tempHeight)
: creates aGrid
full ofSquare
s with appropriate width and heightgetMember(int x, int y)
: returns a pointer to theSquare
at (x, y)expandTop()
,expandRight()
,expandBottom()
,expandLeft()
orexpand(compass direction)
wherecompass
is an enum: adds a row or column to the side of theGrid
specified. This will be calls when the robot moves beyond the current bounds of theGrid
I'm thinking that
Square
's pointers in the 4 directions should remain private, butSquare
should be declared a friend class ofGrid
.I think the best way for
Grid
to keep track of theSquare
s is to have a pointer to theSquare
at (0, 0).