70 lines
1.7 KiB
Plaintext
70 lines
1.7 KiB
Plaintext
Two dimensional array.
|
|
Render each subarray from bottom to top.
|
|
Place each piece in the start of the array.
|
|
|
|
Let user choose from a button above each row where to place a chip.
|
|
|
|
Keep count of player names and colors, maybe with some text input.
|
|
objects.Player has name and color.
|
|
|
|
Turn + Events
|
|
|
|
Width = 7, Height = 6
|
|
|
|
Check from each block of a color (maybe keep track of blocked pieces for effectiveness).
|
|
Maybe allow for custom combinations required to win.
|
|
|
|
Game
|
|
- Winning Conditions
|
|
- board.Board
|
|
- GameObjects
|
|
- Random events
|
|
- Input/Output
|
|
- Players
|
|
|
|
Players
|
|
Class with info about player <- passive
|
|
- name
|
|
- color (of token)
|
|
|
|
Interface for a player's actions <- active
|
|
- Methods for throwing token into column.
|
|
- +Info
|
|
|
|
Input/Output
|
|
- Input interface
|
|
* int getNextColumn(objects.Player p); //Retrieve user input
|
|
- Output interface
|
|
* void displayBoard(board.IBoard b);
|
|
* void displayMessage(String s);
|
|
|
|
Random Events
|
|
- Interface events.IRandomEvent
|
|
* void act(board.IBoard b);
|
|
* String announcement();
|
|
|
|
events.IRandomEvent
|
|
Abstract events.RandomEvent implements events.IRandomEvent (void flipCoin // Does something if heads)
|
|
Shuffle extends events.RandomEvent
|
|
|
|
objects.GameObject
|
|
objects.Token
|
|
Owner instanceof objects.Player
|
|
|
|
GameObjects(objects.Token, empty)
|
|
* One class
|
|
* getColor();
|
|
|
|
Winning Conditions
|
|
- Interface events.IWinCondition
|
|
* boolean hasWon(objects.Player p, board.IBoard board);
|
|
|
|
|
|
"Main" method (Game)
|
|
- Outer loop: "While the game has not been finished"
|
|
1) Determine who's turn
|
|
2) Get next input: int j = input.getNextColumn(p);
|
|
3) Execute move: p throws in column j.
|
|
4) Check if p has won.
|
|
5) Update view (output.displayBoard())
|
|
6) events.RandomEvent.act(); |