Message Boards Message Boards

0 Replies
5 Total Likes
View groups...
Share this post:

Triangle Peg Game

Posted 9 years ago

June 1 is the international Children's Day celebrated in many countries, so I decided to spend the last weekend developing a Mathematica version of the Triangle Peg Game to impress some young friends. I've only very recently discovered the game, and this is my very first game developed with Mathematica (notebook attached). Thanks very much to the author of the other post Raiden Arcade game. I learned all the basics by studying the code of many other games mentioned there.

The rules of Peg Game are quite simple:

  1. You must jump each peg over another peg, but only if there is an open space.
  2. Each peg you jump over must be removed.
  3. The goal is t have as less pegs left as possible. Leave only one, and you're the genius :)

The standard version has 15 pegs, but I wonder how the game will look like by increasing the size. The version I developed allows a user to choose the size of the board and the open space at the beginning:

first interface

Then the user can simply click around to make the pegs disappear ( the adorable Wolfie here stands for peg ):

second interface

I am really impressed by how easy it is to draw graphics and create interactions with Wolfram Language. In fact, the first thing I did is to create the grids -- and this saved a lot of papers as there's no need to draw the board to figure out the relationships of the pegs.

Welcome any suggestions to improve the code or the behavior.

For people who are more interested in solutions, here are some good links I found:

Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
or Discard

Group Abstract Group Abstract