You are Red
Click on a piece to select it.
Click on new location to move to it.

Good Luck!

Scroll down to view comments and reset button.
or
Switch to full screen view if you can.

 

I do not know who wrote this Checkers script. I located it at Cut-n-Paste JavaScript and could not resist includeing it here. I think it is an excelent fit.. Below is what the author has to say about his script.
Thank you who ever you are. Lynn R. Dutro & The Jonesborough Storytellers Guild

 

The game of the month is checkers, my old childhood favorite. I remember playing it at age 5, so I assumed that it would be easy enough to program the logic of the game if I could understand it at age 5.... But I was wrong!

The task I was faced was programming the logic of the computer so it would know which was the best and safest move. My first attempt was to analyze every possible move and it's result. So the computer's 12 pieces can move a single space in four possible directions (if the piece is kinged) and can jump in 4 possible directions. That's 96 possibilities. Then you have to analyze the resultant board. There are another 96 possibilities that the opponent can take. So 96 by 96 is 9216! Needless to say that JavaScript is not built to handle those enormous calculations. So I scrapped the first strategy and tried a second. This strategy has 4 basic steps:

  1. See if the opponent can jump you and try to prevent it.
  2. If no moves as a result of step 1, try to find some places the computer can jump it's opponent.
  3. If no jumps taken, then try and find a safe, single space move.
  4. If no safe moves, take what you can get.

 JavaScript seemed to be able to handle this algorithm. I admit that this algorithm is not an unbeatable algorithm by any means. But I do say that this algorithm is about all the complexity that JavaScript can handle. The language was just not built to be performing super-complex calculations. With that in mind, see if you can beat the computer in the example below! (But if you do, don't pat yourself on the back too much... unless you are only 5 years old.) Enjoy!


[Home] [ Stories Online] [Members] [Tuesday Schedule] [Workshops] [Links] [Join] [Site Map]


Design by Lynn Dutro Computerworks
e-mail: lynn@ldco.com
Copyright © Lynn R. Dutro and The Jonesborough Storytellers Guild
Credits, Links & Copyright Information