The Triangle PuzzleTM
(Windows, OS X, Linux (GTK+), Java)

by Mohan Embar

Hi All,

Thanks to you, I won the Community Prize:

http://visitmix.com/News/MIX-10K-Winners-Announced

$1000 of this prize is going to these folks: http://www.vegfamcharity.org.uk/

The other $500 is going to another non-profit.

Thanks again!

-- Mohan

Introduction

The Triangle Puzzle is a fun, challenging, animated puzzle game with hints! I've written two versions: one written in 2000 for Windows, Windows CE, and Palm OS, and another written in 2008 for Windows, Mac OS X, Linux (GTK+) and Microsoft Silverlight (with more versions forthcoming). Most of the 2008 versions have cool sounds and larger pegs.


Rated Five Cows by Tucows (Palm OS version)!

The Triangle Puzzle features fun, animated pegs and a hint mode! Versions are available for Windows, Mac OS X, Windows CE, PalmOS and Linux!

The HTML5 / Canvas / Javascript (written in 2017)

The Windows, OS X and Linux versions (written in 2008)

The PalmOS and Windows (CE) versions (written in 2000)

To play, you remove a starting peg from any hole, then repeatedly choose an arbitrary peg and then jump either horizontally or diagonally over an occupied hole into an empty hole, removing the peg you jumped over. You repeat this process until there are no moves left. The object of the game is to end up with exactly one peg.

example.gif (7735 bytes)

Examples of legal moves (Java version screenshot)

Source code will be available sometime soon. (We have contacted a publisher about a possible book on this subject.)

Why I Wrote This

Technical Reasons

I wrote the 2008 version of the Triangle Puzzle as a proof of concept for an extremely lightweight, cross-platform virtual machine which currently runs on Windows, OS X, Linux and Microsoft Silverlight. (The somewhat large executable sizes are due to the embedded sound files, not the executable itself.)

I wrote the 2000 version of the Triangle Puzzle to show off my Palm OS® C++ application framework which is lightweight while still providing:

  • an object-oriented framework for forms and databases
  • automatic support for program options
  • automatic support for reading Memo Pad records with configuration information
  • built-in, configurable About and Instruction boxes
  • layered event handling

Click here to contact us for a whitepaper, more details and licensing information.

I also wanted illustrate several programming techniques (although most play the game for its own sake and couldn't care less about these techniques):

  • Applications can be written in such a way that they survive ports across languages and operating systems with a minimum of change (current supported languages: C++, C#, Java, Delphi; operating systems:  Win32, Mac OS X, Linux, WinCE, Palm OS, and any OS with a decent Java implementation).
  • Java isn't the only way to achieve cross-platform results, even with a non-trivial user interface. The native C++ executables for Win32, OS X, Linux, WinCE and Palm OS share the same, sizeable codebase with only a slight amount of operating-system-specific code. What's more, the resultant executables are small and fast (the 8K solution cache increases the size somewhat in the 2000 Palm OS version, and the sound files add bulk to the 2008 Win32 and OS X versions).
  • Java, on the other hand, can be pretty cool when appropriately used. The Java implementation of the Triangle Puzzle runs beautifully on Win32, Personal Java for Windows CE, Linux and HP-UX. (Note: That statement was true in 2000. More recent JVMs have AWT issues which cause problems in the current Java implementation.)

Personal Reasons

I wrote the first incarnation of the Triangle Puzzle on a TRS-80 Model III when I was 14 years old. That summer, we had gone on a family vacation to Door County, Wisconsin and I found and bought the puzzle at a gift shop. I spent that entire vacation unsuccessfully trying to solve the puzzle myself. When I got home, I typed in the BASIC version (here's the listing!) and started it running. It was churning away when my mom called out "Mohan, the pancakes are ready!" and I had to tear myself away.

When I came back upstairs, I saw SOLUTION FOUND: on my screen with a bunch of moves. My first reaction was: "Yeah right," and half-heartedly started making the moves. To my shock, the program had found a solution!

The Program

To play the game,

  • single-click on the starting peg to remove
  • for each move, single-click on the peg to move, then single-click on the hole to jump to
  • click on the [Undo] and [Redo] buttons to undo/redo a move; you can also click on the undo/redo toolbar buttons
  • click on [Hint] to have the program suggest a move
  • click on the Solvable? checkbox to have the computer indicate whether a solution to the puzzle exists after each move you make
  • on supported platforms, click on the Sound? checkbox to toggle sound on and off
  • choose New Game (either from the menu or the toolbar button, depending on the implementation) to start a new game

Click here to play the HTML5 / Javascript version!

Note: The images in this program may not be used without prior consent.

Platform Downloads

In addition to the Java version, The Triangle Puzzle has native executables that run on Windows, OS X, Linux, PalmOS and Windows CE.

Download them from here. Download by first saving the file to a folder on your hard drive, then run the install program (Windows) or unzipping the file (Palm). OS X users can drag the application from the .dmg file or play it directly from there.

2008 Version

Windows XP/Vista

Mac OS X

Linux

2000 Version

Palm OS

Windows 95/98/NT4.0/2000

Windows CE (HPC, Palm-Sized PC, Pocket PC, HPC/Pro)

Usage Terms and Conditions

The Triangle PuzzleTM Copyright © 2000-2008 by Mohan Embar All Rights Reserved.

The Triangle PuzzleTM is written as a personal project by Mohan Embar. He has made this program available for download on this website under the following terms and conditions. Usage of this program indicates your acceptance of the following license conditions. If you do not agree with these terms, you may not use this program.

This program is PropagandaWare. If you continue using this program seven days after the first use, you agree to visit the following websites:

You are exempt from this agreement if you do not have Internet access or if you have purchased this program from me for a fee.

Permission is granted to any individual or institution to copy or redistribute this software provided that:

  • it is not altered in any way
  • it is not sold for profit
  • this copyright notice is displayed
  • if made available for download on a non-FTP web page, that a link be made to http://www.thisiscool.com/ whenever possible
This program comes with no warranties, either express or implied. In no event will the copyright holder be liable for any damages resulting from the use of this software.