BLOKPARTY LITE
Blokus board game using HTML 5 and JS
Gameplay
- Order of play is based on color, with red going first, followed by yellow, green, and blue.
- The first piece played of each color is placed in one of the board's four corners.
- Each new piece played must be placed so that it touches at least one piece of the same color, with only corner-to-corner contact allowed—edges cannot touch. However, edge-to-edge contact is allowed when two pieces of different color are involved.
- When a player cannot place a piece, he or she passes, and play continues as normal for the remaining players.
- The game ends when no one can place a piece.
Scoring
- A player gains one point for each square placed on the board (e.g. playing a pentomino is worth +5 points).
- At the end of the game, unplayed pieces count against the player's score (e.g. an unplayed tetromino is worth -4 points).
- If a player has played all of their pieces, they gain a bonus of +20 if the last piece played was the monomino. Otherwise the bonus is +15.
- The maximum score possible for a player is 1x1 + 2x1 + 3x2 + 4x5 + 5x12 + 20 (all pieces on the board, with the monomino played last) for a total of 109 points.
Updates
- 2/18:
- Fixed bug that created playable corners bordering same color.
- Game over occurs when last player has played all of their pieces.
- Fixed one piece rep error in 18.
- 1/27:
- Added images for flip/rotate.
- Fixed switched flipHoriz and flipVert.
- Fixed bugs in updating final scores.
- 1/26:
- Made "snap-to" of pieces more forgiving at edges of board.
- Added functionality to resignCurrentPlayer and button
- Max final score of 109 correct (89 squares + 20 final monomino bonus)
- 1/22:
- Made "snap-to" of pieces more forgiving.
- Validates moves. Corner case needs fixing.
- 1/7:
- Updates move representations on the board; shows available corners for current color
- 12/8:
- Checks validity of user's moves
- Shows playable corners for current color
- 11/21:
- Corrected "snap-to" using Math.floor instead of Math.round
- 11/20:
- "Snap-to" of draggable piece to grid or edit pane.
- Removes a piece from the available lineup after it has been placed on board.
- 11/17:
- Replace bottom-right coordinates of pieces with height and width
- Implemented deep copy of selected pieces.
- Recognizes mouse down, mouse up, and mouse move. Current piece is draggable.
- 11/14:
- Preparing for click/drag: Added variables for dragging, valid state, etc.
- Preparing for click/drag: Reorganized canvas drawing methods.
- 11/8:
- Enabled rotateCW/flipHoriz/flipVert functionalities. The buttons aren't labeled, but they are in top-bottom order in the edit pane.
- To use: click on any RED piece. Click on any of the blank squares next to the piece's larger representation.
- Initialized and styled scoreboard.
- 11/7:
- Checks piece container and piece boundaries to determine if mouse click in canvas is on a currently playable piece. Will see if something more like 'filter' can be used instead of a for-loop.
- Clicking on a piece of the current color causes it to display in the edit pane. Current color is manually set to red.
- Fixed a missing triomino. Whoops.
- 10/31:
- Initializes and draws pieces in right pane. Not sure if nested closures are a good thing.
- drawBoard function: re-draws board according to 2D array of colors
- 10/30: Created canvas and board
TODO list
Select pieces from the right pane
Create edit pane (for flips and rotations)
Display pieces in edit pane
Position and style the scoreboard (blank ul under the canvas)
Deep copy selected pieces
Replace bottom-right coordinates of pieces with height and width
Dragged pieces must either snap to board or back to edit pane
Click and drag pieces from edit pane to board
Make snap-to more forgiving
Draw actual images for rotate/flip buttons (button is functional, regardless)
Update scoreboard at end of game. Does not subtract unused points.
Check if a move is valid--error when placing a corner piece near an edge of same color
If a player has played all their pieces, remove from lineup.
Discovered new bug; unsure of origin. Check piece reps, move validation, piece playing procedure. Bug resulted from error in piece rep #18.
- Consolidate global vars
- Implement game-play rules
- Double-check board and move representations in piece initialization.