[Home] [Puzzles & Projects] [Delphi Techniques] [Math topics] [Library] [Utilities]
Hip is a game invented by the well known
recreational mathematician Martin Gardner. He named it Hip "because of the hipster's reputed
distain for squares".
The first player to complete a square is the loser.
There is essentially only one way for a complete game to end in a tie. Can you find it?
Background & Techniques
Here's another interesting Martin Gardner puzzle/game, originally published in his "Mathematical Recreations" Scientific American magazine column in the 60's. Which explains his use of the the terms "Hip" and "Hipster" - terms probably unfamiliar to most of today's viewers.
In his write-up in the book referenced above, he relates that for several months after first publication he had assumed that a tie game was impossible. Then a reader, computer science major of course, found the tie game configuration. I'll confess up front that I didn't succeed in rediscovering the tie game - this program plays a tie game when when computer plays computer, but the game played is simply a random display of the moves from the solution published in Gardner's book.
Two classes are defined: TSquare defines the four corners of any square and identifies the how many of the corners are "owned" by each player. Squarelist is a TStringlist that has a string version of the sorted coordinates as a unique key for each square and a Tsquare object stored as a Objects entry. Squarelist will always contain 105 entries. In general it has been proven, (not by me), that n2 x (n2-1) / 12 squares may be formed on an n x n board.
TPlayer identifies each player, whether it is a computer, and the points currently owned. When a player makes a move, the MakeMove procedure scans Squarelist to see if this point gives 4 corner ownership to this player for any square in the list (i.e. he just completed a square and lost).
Custom cursors are defined to indicate the current player by color, red for player A and blue for player B. Cursors are contained in resource file Cursors.res. Four files used to build Cusors.res; (Cursors.rc, Genres,bat, Red.cur, and Blue.cur), are included with the source for completeness but not required for compiling Hip. Check the Custom Cursors page in the Delphi-Techniques section for more information.
Addendum August 20, 2008: This is the first update sine the program was posted in 2001. Version 3 of HIP wad prompted by an email from Sadanand Kasargod [email@example.com] who spent what must have been a considerable amount of time searching for additional tie games on the 6x6 board. I had quoted Gardner's comment that there is "essentially" only one way for a a game to end in a tie. Sadanand found 3 others, but two are the same if one is rotated and the colors reversed. We settled on three "essentially" different tie games that cannot be transformed into another by rotation, mirroring, or color reversal. I added a button to replay tie games. Other changes include the ability to retract moves to aid in studying game and choice of playing on 5x5, 6x6, and 7x7 game board sizes. Again according to Gardner's book, My Best Mathematical and Logical Puzzles, ties are not possible for 7x7 boards or higher.
Addendum August 25, 2008: When updating this page last week, I noticed the suggestion for a variation of the rules which requires selecting 2 points for each turn after the first. I created Version 4 with that option along with some enhancements to the retraction process.
Running/Exploring the Program
Suggestions for Further Explorations
Copyright © 2000-2018, Gary Darby All rights reserved.