diff --git a/README.md b/README.md index f662bfa..b3c4898 100644 --- a/README.md +++ b/README.md @@ -73,6 +73,13 @@ echo "history: " & $history For the content pulled by "import knights", see https://github.com/JohnAD/negamax/blob/master/examples/knights.nim +# Videos + +The following two videos (to be watched in sequence), demonstrate how to use this library and the 'turn_based_game' library: + +* Using "turn_based_game": https://www.youtube.com/watch?v=u6w8vT-oBjE +* Using "negamax": https://www.youtube.com/watch?v=op4Mcgszshk + # Credit The code for this engine mimics that written in Python at the EasyAI library located at . That library contains both the game rule engine (called TwoPlayerGame) as well as a variety of AI algorithms to play as game players, such as Negamax. diff --git a/negamax.nimble b/negamax.nimble index 3d55e52..e21e202 100644 --- a/negamax.nimble +++ b/negamax.nimble @@ -1,6 +1,6 @@ # Package -version = "0.0.1" +version = "0.0.2" author = "John Dupuy" description = "Negamax AI algorithm for turn based games" license = "MIT" diff --git a/src/negamax.nim b/src/negamax.nim index eedd383..071d514 100644 --- a/src/negamax.nim +++ b/src/negamax.nim @@ -104,10 +104,14 @@ type NegamaxPlayer* = ref object of Player depth*: int + # method get_move*(self: NegamaxPlayer, game: Game): string = var new_game: Game - deepCopy(new_game, game) + when defined(js): + new_game = game + else: + deepCopy(new_game, game) var choice = negamax(new_game, self.depth) return choice