Chen Yirong (春江) >
Games-BeyondMath24-0.01 >
Game::BeyondMath24

Game::BeyondMath24 - A 24 game implementation with enhancements of more cards, more operators and customizable target which by default is 24.

use Game::BeyondMath24; my @solutions=beyondMath24([3 3 8 8]); perl -MGame::BeyondMath24 -e "print join(qq{\t},beyondMath24(\@ARGV))" 3 3 8 8 #The following example uses 5 cards to compute 29 dot with 6 kinds of operators # (including the empty string '' ) my @solutions=beyondMath24([3 3 8 8 3], 29, ['+','-','*','/','^','']);

BeyondMath24 is an extended version of mathmatical card game "24 game" with enhancements of more cards, more operators and customizable target which by default is 24.

The following description of "24 game" is taken from Wikipedia (http://en.wikipedia.org/wiki/24_Game):

The 24 Game is a mathematical card game in which the object is to find a way to manipulate four integers so that the end result is 24. Addition, subtraction, multiplication, or division, and sometimes other operations, may be used to make four digits from one to nine equal 24. For an example card with the numbers 4,7,8,8, a possible solution is the following: 8/8=1, 7-1=6, 6×4=24.

The game has been played in Shanghai since the 1960s[1], using ordinary playing cards. Robert Sun commercialised the game in 1988, introducing dedicated game cards bearing four numbers each, and sold it through his company, Suntex International Inc. There are nine official variations of the 24 Game. The tournament-style competition 24 Challenge is based on the game.

Chen Yirong < cyr.master@gmail.com >, July 9, 2009.

This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.

syntax highlighting: