This repository contains the implementation of a visual game inspired by Mondrian paintings. Players interact with a recursive quad-tree structure to achieve specific goals. Derived from an assignment created by Diane Horton and David Liu from the University of Toronto.
-
The game board, termed a "block", can be:
- A square of a single color.
- A square subdivided into 4 equal-sized blocks.
-
The largest block, which contains the entire structure, is termed the top-level block.
- The top-level block is at level 0 (the root of the quad-tree).
- If it is subdivided, its sub-blocks are at level 1, and so forth.
-
Boards have a maximum allowed depth indicating how many levels it can go down.
Players can perform the following moves:
- Rotating a block clockwise or counterclockwise.
- Reflecting the block horizontally or vertically.
- Smashing a block to give it four brand-new, randomly generated sub-blocks.
Note: Smashing the top-level block or a unit cell (at the maximum depth) is not allowed.
Players are assigned a randomly-generated goal:
- Blob Goal: Aim for the largest "blob" of a given color. A blob is a group of orthogonally connected blocks of the same color.
- Perimeter Goal: Put the most units of a given color on the outer perimeter of the board. Corner cells count twice towards the score.
Each goal pertains to a specific target color.
- Start the game to get a randomly generated board and goal (navigate to
src/game/BlockGame.java
and build + run the file). - Use the described moves to achieve your goal within a set number of turns.
- Score is calculated based on the chosen goal and the current state of the board.
Adapted from an assignment by Diane Horton and David Liu from the University of Toronto.