I'm working on an implementation of Kalah, the game most commonly known as 'mancala' in the Western world (despite mancala being an entire family of games). I've got it mostly working, but I've hit a bug I can't figure out.
You can find the code here. You should be able to reproduce the bug by following these steps:
Start the program. Choose one player, intelligence 3, three beads per house.
Make the following moves: D, A, C, B, D, C, E, B, A, D, E. At this point the computer should have a single seed in house L.
Make the move C. This is where the program crashes.
As far as I can tell, the computer's trying to decide what move to make, but it thinks it doesn't have any moves left and is crashing trying to read an empty table of possible moves. Can someone help me figure out where I'm going wrong?
Solved my own problem. I figured out that I was erroneously comparing two tables by reference, so the part of the code intended to be called if a table was empty never got called.
You can post now and register later.
If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.
I'm working on an implementation of Kalah, the game most commonly known as 'mancala' in the Western world (despite mancala being an entire family of games). I've got it mostly working, but I've hit a bug I can't figure out.
You can find the code here. You should be able to reproduce the bug by following these steps:
Start the program. Choose one player, intelligence 3, three beads per house.Make the following moves: D, A, C, B, D, C, E, B, A, D, E. At this point the computer should have a single seed in house L.Make the move C. This is where the program crashes.As far as I can tell, the computer's trying to decide what move to make, but it thinks it doesn't have any moves left and is crashing trying to read an empty table of possible moves. Can someone help me figure out where I'm going wrong?Solved my own problem. I figured out that I was erroneously comparing two tables by reference, so the part of the code intended to be called if a table was empty never got called.
Link to post
Share on other sites