This list highlights a typical turn in a game of a match three style game. It also conveniently highlights the features of this module.
- Populates an initial board of orbs in a state that has no matches currently, but has at least one potential match.
- Orb values are customizable. They default to integers 0 through 7.
- Board sizes are customizable. They default to 8x8 in size.
- Boards support "swapping", which move one orb to another adjacent square (not diagonal) to attempt a match.
- Boards scan for matches after swap calls. Any locations on the board that have a consecutive 3+ run of the same orb in a row are "matched".
- Matched orbs are tallied, and removed. You are given an object informing you of what orbs were removed, and where, for animation purposes.
- Matched orbs are replaced from above with new orbs (gravity defaults to "down"). What type of orbs drop in is random by default, but can be configured.
- After new orbs drop in, more matches are searched for. Any matches found are returned to you for animation purposes.
- This cycle continues until there are no more matches available.
- If there are zero potential matches, the board is shuffled until there are no current board matches, but at least one potential match.
- Control of the board is returned to the consumer.
This application under the MIT License.