Classes
Main Class/GUI
- State Variables: moves (int), tiles (Tile[][]), buddy(GridPane), emptyButton (Tile)
Tile Class (extends Button)
- State Variables: isEmpty (boolean), value (int), neighbors (Optional
[4]), Direction( enumLEFT, RIGHT, UP, DOWN), int x, int y - Tile(value)
- Getters/Setters
- pull(Direction)
- Returns the current value and calls empty()
- swap(Tile)
- Should only happen if this is Empty
- Sets value to output of pull(); sets isEmpty to false.
- empty() - will set isEmpty to true, set value to 16
- onClick:
- If dist from emptyButton = 1:
- Call emptyButton.swap(this)
Permutation Class
- Permutation (int n) - create , through IllegalArgumentException if n <= 0
- Ordering[]2
- isEven()
- applyToList() - check for corr
- applyToArray
- applyTo2DArray (nxn)
Behaviors
- Creation of the Screen
- Utilizes the Permutation to order the values 1-16
- Swapping
- Calls methods of the two adjacent tiles.
- Winning
- Checks for the order of the tiles to see if it is sorted.
Tasks:
- Make Permutation Class (Bo)
- Define/style GUI interface (Jake)
- Behavior of Tile Class (David)
- Start Making Algorithm (Pranet)
Algorithm
TBD (Pranet)