I’ve been working with Haskell every day for the last sixty days, even if it was just 15 minutes of reading or playing around each day.
I managed to implement the board game Reversi (Othello) with a Minimax AI and Alpha-Beta pruning. I also implemented Spot, which is even better suitable for a Minimax AI, however, that is still due.
Maybe a rule-based AI or a Minimax AI using a more elaborate evaluation function would be an interesting next step, otherwise Minimax is just to weak or slow.
12345678
a XXXXXXXX a
b OOOOXXXX b
c OXOOOXOX c
d OXOOXOOX d
e OXOOXOOX e
f OXXXXXXX f
g OXXXXXXX g
h XXXXXXXX h
12345678
X 43 21 O
Player X wins 43:21
Good UX (maybe the board is a bit cramped), solid engine.
I was not able to run it via makefile, and added this to the top of the file
Thanks for the feedback! I’m working on Arch, which requires -dynamic compilation. For parallel execution, run it using +RTS -Nx flag, where x is the number of CPUs to be used, which builds up the game tree in parallel. Thanks also for the cabal script; I still have to get into this. Then I also need to modularize the code. (I’m working through Programming Haskell (2nd Edition), which only covers the absolute core of the language.)