A twist of the classic NumberMunchers game, written in JavaScript/JSX using React and Redux
- Hero: the movable main character, controlled by the Player
- Player: you! But also a container called "Player" that handles input logic
- GameBoard: where all UI exists in
- Grid/GridCell: the cells (and groups of cells) that the hero can move on
- Numbers: the "edible" numbers that possibly exist in each cell. Are central to the current rule
- Rule: the current mathematical "rule" the player must abide to to win. Example: "Multiples of 4", "Prime numbers"
- Grid
- Fixed size grid / rectangle (WxH cells)
- Cells can have a value in them or be empty
- Hero/monsters can walk on top of cells
- Hero
- Hero will start at position (0,0) [future update: start at middle]
- Can move only one horizontal or vertical cell at a time (no diagonals), only limited by walls/extremes
- Can eat numbers when prompted to
- Starts game with XXX lives [incomplete]
- Loses a life on contact with monster or when eating a incorrect option [incomplete]
- Player
- Selects moves for hero (move directions and "eat")
- Numbers
- Used to fill up cells. Number generation follows a set of pre-defined rules
- Guarantee a 50%+ number of correct options
- Levels
- Every level has a mathematical proposition (e.g. Multiples of 5, Equals 5, Prime numbers)
- Start with every grid cell populated by a generated number, possibly a correct answer
- Monsters (in future version!)
- Grid
- Grid is composed on multiple individual cell components GridCells. The cells are contained in a higher order component called Grid, placed inside GameBoard. Cells are shaped as squares
- Each cell component can hold a value/text, passed in as a parameter. If null, considered an empty cell (can be emptied under conditions e.g. hero eating number)
- Cells are dumb components that can be "walked" upon. This is done transparently, without knowledge of the cell component (i.e. hero moves on top of cells and is not contained in them)
- Hero
- Get grid cell at centralized position and place hero initially
- Update hero position with -1/+1 position index per move command, not allowing diagonal moves (and possibly delaying move inputs). Movements are made by the Player container
- Enter/space keyboard input prompts hero to eat option/value
- Life count held in app state
- When eating an option, check for correct field. If false, remove a life 1. Not accounting for monster kills yet since monsters don't exist
- Player
- Players moves based on reading the keyboard inputs and passing the moves to the interessed components
- Numbers
- Values are generated by a dedicated class. Current possible value rules are: + Prime Numbers + Multiples + Sum expressions
- Will always have number of correct options in range 50% + (5 to 15%) --> [55 to 65]% of # of cells
- Hero life count
- Monsters
- Selectable rules
- High score