Logo + Final UML Diagram
Saturday, July 4, 2009 22:29I am pretty much ready to release v1.0 of my SOS game, however, I was hoping that I would have come up with a logo that I could use to represent both my website and my software.
The following is a summary of my progress this week leading up to the release of version 1.0 (official release):
- PlayerView:
- removed variables for frame width and height
- Board:
- added variables width and height for the size of the board in pixels to use in setting the size of the frame when a new board is created
- added methods getWidth, getHeight and initializeGame, the last is used to initialize all the relevant variables in creating a new game, in which a new board size is being used
- added variable gameInProgress
- added methods isGameInProgess and gameOver
- removed setNewBoard, since no use for passing parameters so just made a method oldBoard
- BoardView:
- added variable pView to store a reference to PlayerView (which is the JFrame) to allow me to change it’s size when a new board size is being used for the first time
- MenuBar:
- changed cbEasyItem, cbMediumItem, and cbLargeItem to cbSmallItem, cbMediumItem, and cbLargeItem respectively
- removed variable menuBar
- Move:
- removed variable currPlayer and added player so that I could store the player for that move as an int
- removed methods getChoice and setChoice
- OptionsView:
- added variable options
- Player:
- added variable gamesWon
- added methods getGamesWon, addToGamesWon, subFromTally
- PlayerView:
- added variable winnerView, turnView
- removed variable introView
- Position:
- removed methods advanceRow, advanceColumn
- ScoreCardView:
- removed variable playerTwo
- added variables pOneGamesWon, pTwoGamesWon, gamesWon
- WinnerView:
- added variable scoreCard
- removed class IntroView, explained in v1.0 feature set.
- added class About to display information about my game
- reformed the instructions so that it is more legible and not as big of a box
Changing the board size (playing area) by redrawing the board and setting the new frame size, so that all the elements were in the viewable area, was tricky. I still haven’t been able to make it as elegant as I would have liked. This is because I had to hard code some numbers in to modify the width and height and pass the new value to the PlayerView frames setSize method. If I wanted to create a custom board size option, this fact would make it very difficult and I would have to come up with a better way, since the simplest (just clearing and redrawing the elements) wouldn’t allow for the viewing area to grow/shrink to encompass just the components.
To implement the games won feature it took a lot of trial and error to get something that worked solidly. I just about gave up, but then I thought to myself, “This is an opportunity for me to learn something new, again”, so I kept plugging away until I found something that worked, which turned out to be using the isGameInProgress Boolean variable in Board as my extra condition to prevent the infinite loop in the WinnerView as the status was updated each time by the method addToGamesWon in order to keep the views in-sync, but then (without the extra condition) the games won would be incremented until a stack overflow occurred crashing the program.
I now have the classes organized into the following categories:
| Observers: -BoardView -ScoreCardView -TurnView -UndoView -WinnerView |
Observable: -Board -MoveHistory -Player -Turn |
| Singelton: -Board -MoveHistory -Options -ScoreCard -Turn |
Enumeration: -Choice |
