Review 4Gewinnt
- In general readable code and understandable comments
VierGewinnt.elm:
- using function and then function2 (e.g. place_token and place_token2) seems unneccessary (line 62: ... then Nothing else => line 65)
- using Maybe is a good idea to handle errors or wrong inputs (no negative column numbers) but it might be better to „ignore“ them and keeping the state of the grid as it was
(place_token : Grid -> Player -> Int -> Grid place_token grid player column_number = if column_number < 0 then grid else ...)
. This would also reduce some code.
Main.elm:
- well written view (using functions that build different parts of the view instead of throwing everything in the view)
- to keep the user from trying to place tokens after the game is finished you could disable the „place“ buttons by adding the attribute:
disabled (if not (model.finishedState == VG.Unfinished))