The GamePiece class
The GamePiece class represents an individual pipe on the game board. One GamePiece has no knowledge of any other game pieces (that is the responsibility of the GameBoard class), but it will need to be able to provide information about the pipe to objects that use the GamePiece class. Our class has the following requirements:
Identify the sides of each piece that contain pipe connectors
Differentiate between game pieces that are filled with water and that are empty
Allow game pieces to be updated
Automatically handle rotation by changing the piece type to the appropriate new piece type
Given one side of a piece, provide the other sides of the piece in order to facilitate determining where water can flow through the game board
Provide a
Rectangle
that will be used when the piece is drawn, to locate the graphic for the piece on the sprite sheet
Identifying a GamePiece
While the sprite sheet contains thirteen different images, only twelve of them are actual game pieces (the last...