Basically i am somewhat at a loss as to how to properly begin and implement this program... i understand the concept behind having three classes (Square, Board, myDriver)...the thing that is keeping me from knwoing how to start this is the creation of "squares". The board class is supposed to create a 2 by 2 array of squares...i cant seem to figure out how to do this since each square needs a side (top,bottom,left,right which is a boolean value). The whole program set up is below:
Write a program (consisting of 3 classes) which allows two human players to play the game Lines (described in class) on a 3 by 3 grid (ie with a gameboard consisting of 4 squares).
Your first class will be called Square. This class will have 4 private boolean variables (top/bottom/left/right) with accessors and mutators. You may add other variables/methods as desired. For example, you may want to have a method called complete (telling whether all four sides have been used).
Your second class will be called Board. This class will have a private variable layout which is a 2x2 array of Squares. Add methods as necessary. For example, you probably want to have a method called markLine which takes two ints and marks the line between those integers (if it exists) and another method toString which returns a String which represents the board. You may add other variables/methods as desired. For example, I used 2 helper methods called markVert and markHoriz.
Your last class will be called Driver. This class will have a main method (and possibly helper methods) which creates an instance of Board and takes input from the two players (allowing each to draw one line). Once all lines have been marked, it should print out the score.
You don't have to have every line of a program clear in your head before you start to code. You definitely shouldn't try to write a whole program before you compile and run it. Code a little, test a little, code some more.
So first, you write the square class:
Make sure that compiles. Then add those booleans, and accessors and mutators. Just for fun, add a main() routine to Square (you can delete it later):
Now run Square, make sure you see what you expect.
Then create the Board class, which might contain stuff like
Make sure all this compiles. Then give "Board" a main() and test some of its functionality.