Turn the tests into more of a guide through the steps. There are now six tutorial steps, four "core" and two "extended", and the tests can be progressively enabled to follow the implementation order.
Core steps
Logic for whether a board is a winning board:
write is_square_2048
write is_board_winning using is_square_2048
Logic for shifting the board left, right, up and down.
write shift_left_helper
write shift_board using shift_left_helper
Logic for inserting new squares
write insert_into_row using replace_one from Utils
write insert_square using replace_one and insert_into_row
(At this point the game should be somewhat playable.)
Logic for whether a board is a losing board
write is_complete_row
write is_game_over using is_complete_row
Extension steps
Provenance of tiles. This enables sliding animations.
write square_provenances
update the shifts / string_of_square / etc. functions
Making new square insertion non-deterministic
Update insert_square to use a random position, using Utils.replace_at
Turn the tests into more of a guide through the steps. There are now six tutorial steps, four "core" and two "extended", and the tests can be progressively enabled to follow the implementation order.
Core steps
is_square_2048
is_board_winning
usingis_square_2048
shift_left_helper
shift_board
usingshift_left_helper
insert_into_row
usingreplace_one
fromUtils
insert_square
usingreplace_one
andinsert_into_row
(At this point the game should be somewhat playable.)
is_complete_row
is_game_over
usingis_complete_row
Extension steps
square_provenances
shift
s /string_of_square
/ etc. functionsinsert_square
to use a random position, usingUtils.replace_at