Jump to content
  • Sky
  • Blueberry
  • Slate
  • Blackcurrant
  • Watermelon
  • Strawberry
  • Orange
  • Banana
  • Apple
  • Emerald
  • Chocolate
  • Charcoal
  • 0

Help me debug my game!


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

0 answers to this question

Recommended Posts

There have been no answers to this question yet

Join the conversation

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.

Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • Create New...

Important Information

By using this site, you agree to our Terms of Use and Privacy Policy.