games pain
Sponsored Links
Sponsored Links
Secleted [ 0 ] software to compare
Results 1 - 15 of about 2174
Games::Mastermind 0.03
Games::Mastermind is a simple framework for MasterMind games. more>>
Games::Mastermind is a simple framework for MasterMind games.
SYNOPSIS
use Games::Mastermind;
# the classic game
$mm = Games::Mastermind->new;
# make a guess
$marks = $game->play(qw( Y C W R ));
# results
print "You win!n" if $marks->[0] == $mm->holes();
# the game history is available at all times
$history = $mm->history();
$last_turn = $mm->history()->[-1];
# reset the game
$mm->reset();
Games::Mastermind is a very simple framework for running Mastermind games.
<<lessSYNOPSIS
use Games::Mastermind;
# the classic game
$mm = Games::Mastermind->new;
# make a guess
$marks = $game->play(qw( Y C W R ));
# results
print "You win!n" if $marks->[0] == $mm->holes();
# the game history is available at all times
$history = $mm->history();
$last_turn = $mm->history()->[-1];
# reset the game
$mm->reset();
Games::Mastermind is a very simple framework for running Mastermind games.
Download (0.014MB)
Added: 2007-01-04 License: Perl Artistic License Price:
1024 downloads
Games::Goban 1.100
Games::Goban is a board for playing go, renju, othello, etc. more>>
Games::Goban is a board for playing go, renju, othello, etc.
SYNOPSIS
use Games::Goban;
my $board = new Games::Goban (
size => 19,
game => "go",
white => "Seigen, Go",
black => "Minoru, Kitani",
referee => &Games::Goban::Rules::Go,
);
$board->move("pd"); $board->move("dd");
print $board->as_sgf;
This is a generic module for handling goban-based board games. Theoretically, it can be used to handle many of the other games which can use Smart Game Format (SGF) but I want to keep it reasonably restricted in order to keep it simple.
<<lessSYNOPSIS
use Games::Goban;
my $board = new Games::Goban (
size => 19,
game => "go",
white => "Seigen, Go",
black => "Minoru, Kitani",
referee => &Games::Goban::Rules::Go,
);
$board->move("pd"); $board->move("dd");
print $board->as_sgf;
This is a generic module for handling goban-based board games. Theoretically, it can be used to handle many of the other games which can use Smart Game Format (SGF) but I want to keep it reasonably restricted in order to keep it simple.
Download (0.015MB)
Added: 2007-01-06 License: Perl Artistic License Price:
1035 downloads
Java Games 1.0
Java Games is a collection of simple games that are compiled into Java applets and meant to be played online in a Web browser. more>>
Java Games project is a collection of simple games that are compiled into Java applets and meant to be played online in a Web browser.
Currently the collection contains four games: XO World (similar to tic-tac-toe, but with lines of 5 on a 10x10 board); 100 Mack (guess the random combination of 4 images out of a set of six); Memory (flip 2 plates at a time to find matching pairs); and Tetris.
<<lessCurrently the collection contains four games: XO World (similar to tic-tac-toe, but with lines of 5 on a 10x10 board); 100 Mack (guess the random combination of 4 images out of a set of six); Memory (flip 2 plates at a time to find matching pairs); and Tetris.
Download (0.13MB)
Added: 2007-02-20 License: GPL (GNU General Public License) Price:
985 downloads
Games::3D 0.09
Games::3D is a package containing an object system for (not only) 3D games. more>>
Games::3D is a package containing an object system for (not only) 3D games.
SYNOPSIS
use Games::3D::World;
my $world = Games::3D::World->new();
$world->save_to_file( $filename );
my $loaded = Games::3D::world->load_from_file( $filename );
my $thing1 = $world->add ( Games::3D::Thingy->new( ... ) );
my $thing2 = $world->add ( Games::3D::Thingy->new( ... ) );
$world->link($thing1, $thing2);
Games::3D::World provides you with a container class that will contain every object in your game object system. This are primarily objects that have states, change these states and need to announce the states to other objects.
The Games::3D::World container also enables you to save and restore snapshots of your objects system.
Basic things that you object system contains are derived from a class called Games::3D::Thingy. These can represent physical objects (buttons, levers, doors, lights etc) as well as virtual objects (trigger, sensors, links, markers, sound sources etc).
You can link Thingys together, either directly or via Games::3D::Links. The links have some more features than direct linking, which are explained below.
This package also provides you with Games::3D::Sensor, a class for objects that sense state changes and act upon them. Or not, depending on the sensor. Sensors are primarily used to watch for certain conditions and then act when they are met. Examples are the death of an object, values that go below a certain threshold etc.
State changes are transported in the object system with signals.
<<lessSYNOPSIS
use Games::3D::World;
my $world = Games::3D::World->new();
$world->save_to_file( $filename );
my $loaded = Games::3D::world->load_from_file( $filename );
my $thing1 = $world->add ( Games::3D::Thingy->new( ... ) );
my $thing2 = $world->add ( Games::3D::Thingy->new( ... ) );
$world->link($thing1, $thing2);
Games::3D::World provides you with a container class that will contain every object in your game object system. This are primarily objects that have states, change these states and need to announce the states to other objects.
The Games::3D::World container also enables you to save and restore snapshots of your objects system.
Basic things that you object system contains are derived from a class called Games::3D::Thingy. These can represent physical objects (buttons, levers, doors, lights etc) as well as virtual objects (trigger, sensors, links, markers, sound sources etc).
You can link Thingys together, either directly or via Games::3D::Links. The links have some more features than direct linking, which are explained below.
This package also provides you with Games::3D::Sensor, a class for objects that sense state changes and act upon them. Or not, depending on the sensor. Sensors are primarily used to watch for certain conditions and then act when they are met. Examples are the death of an object, values that go below a certain threshold etc.
State changes are transported in the object system with signals.
Download (0.032MB)
Added: 2006-10-02 License: Perl Artistic License Price:
1124 downloads
Games::PerlWar 0.02
Games::PerlWar is a Perl variant of the classic Corewar game. more>>
Games::PerlWar is a Perl variant of the classic Corewar game.
This is a sparring program, similar to the programmed reality of the Matrix.
It has the same basic rules, rules like gravity. What you must learn is that
these rules are no different than the rules of a computer system. Some of
them can be bent, others can be broken. - Morpheus
PerlWar is inspired by the classic http://www.corewar.info/|Corewar game. In this game, players pit snippets of Perl code (called agents) against each other in order to gain control of the vicious virtual battlefield known as... the Array.
GAME PARAMETERS
Size of the Array
The number of cells that the Array possesses. Each cell can hold one agent.
Agent Maximal Size
The maximal length, in characters, of an agent. If an agent is or becomes larger than this limit, it automatically segfaults upon execution.
Game Maximal Number of Iterations
The maximal number of rounds that can be played before a game is declared over.
<<lessThis is a sparring program, similar to the programmed reality of the Matrix.
It has the same basic rules, rules like gravity. What you must learn is that
these rules are no different than the rules of a computer system. Some of
them can be bent, others can be broken. - Morpheus
PerlWar is inspired by the classic http://www.corewar.info/|Corewar game. In this game, players pit snippets of Perl code (called agents) against each other in order to gain control of the vicious virtual battlefield known as... the Array.
GAME PARAMETERS
Size of the Array
The number of cells that the Array possesses. Each cell can hold one agent.
Agent Maximal Size
The maximal length, in characters, of an agent. If an agent is or becomes larger than this limit, it automatically segfaults upon execution.
Game Maximal Number of Iterations
The maximal number of rounds that can be played before a game is declared over.
Download (0.031MB)
Added: 2006-12-28 License: Perl Artistic License Price:
1036 downloads
Games::Alak 0.18
Games::Alak is a simple game-tree implementation of a gomoku-like game. more>>
Games::Alak is a simple game-tree implementation of a gomoku-like game.
SYNOPSIS
% perl -MGames::Alak -e Games::Alak::play
...Or just run Alak.pm as if it were a program...
...Program responds with output, and a prompt:
Lookahead set to 3. I am X, you are O.
Enter h for help
X moves from 1 to 5, yielding .xxxx..oooo
alak>
...and now you enter the commands to play.
This module implements a simple game-tree system for the computer to play against the user in a game of Alak. You can just play the game for fun; or you can use this module as a starting point for understanding game trees (and implementing smarter strategy -- the modules current logic is fairly simple-minded), particularly after reading my Perl Journal #18 article on trees, which discusses this modules implementation of game trees as an example of general tree-shaped data structures.
<<lessSYNOPSIS
% perl -MGames::Alak -e Games::Alak::play
...Or just run Alak.pm as if it were a program...
...Program responds with output, and a prompt:
Lookahead set to 3. I am X, you are O.
Enter h for help
X moves from 1 to 5, yielding .xxxx..oooo
alak>
...and now you enter the commands to play.
This module implements a simple game-tree system for the computer to play against the user in a game of Alak. You can just play the game for fun; or you can use this module as a starting point for understanding game trees (and implementing smarter strategy -- the modules current logic is fairly simple-minded), particularly after reading my Perl Journal #18 article on trees, which discusses this modules implementation of game trees as an example of general tree-shaped data structures.
Download (0.009MB)
Added: 2007-01-02 License: Perl Artistic License Price:
1027 downloads
Harem Games Slot Machine 3.13
Harem Games Slot Machine es un juego gratis de la popular tragaperras de casino donde juegas contra guapas modelos. El objetivo del juego Slot Machine... more>> <<less
Download (525KB)
Added: 2009-04-06 License: Freeware Price: Free
206 downloads
Games::Dice 0.02
Games::Dice is a Perl module that can be used to simulate dice rolls. more>>
Games::Dice is a Perl module that can be used to simulate dice rolls.
SYNOPSIS
use Games::Dice roll;
$strength = roll 3d6+1;
use Games::Dice roll_array;
@rolls = roll_array 4d8;
Games::Dice simulates die rolls. It uses a function-oriented (not object-oriented) interface. No functions are exported by default. At present, there are two functions which are exportable: roll and roll_array. The latter is used internally by roll, but can also be exported by itself.
The number and type of dice to roll is given in a style which should be familiar to players of popular role-playing games: adb[+-*/b]c. a is optional and defaults to 1; it gives the number of dice to roll. b indicates the number of sides to each die; the most common, cube-shaped die is thus a d6. % can be used instead of 100 for b; hence, rolling 2d% and 2d100 is equivalent. roll simulates a rolls of b-sided dice and adds together the results.
The optional end, consisting of one of +-*/b and a number c, can modify the sum of the individual dice. +-*/ are similar in that they take the sum of the rolls and add or subtract c, or multiply or divide the sum by c. (x can also be used instead of *.) Hence, 1d6+2 gives a number in the range 3..8, and 2d4*10 gives a number in the range 20..80. (Using / truncates the result to an int after dividing.) Using b in this slot is a little different: its short for "best" and indicates "roll a number of dice, but add together only the best few". For example, 5d6b3 rolls five six- sided dice and adds together the three best rolls. This is sometimes used, for example, in roll-playing to give higher averages.
Generally, roll probably provides the nicer interface, since it does the adding up itself. However, in some situations one may wish to process the individual rolls (for example, I am told that in the game Feng Shui, the number of dice to be rolled cannot be determined in advance but depends on whether any 6s were rolled); in such a case, one can use roll_array to return an array of values, which can then be examined or processed in an application-dependent manner.
This having been said, comments and additions (especially if accompanied by code!) to Games::Dice are welcome. So, using the above example, if anyone wishes to contribute a function along the lines of roll_feng_shui to become part of Games::Dice (or to support any other style of die rolling), you can contribute it to the authors address, listed below.
<<lessSYNOPSIS
use Games::Dice roll;
$strength = roll 3d6+1;
use Games::Dice roll_array;
@rolls = roll_array 4d8;
Games::Dice simulates die rolls. It uses a function-oriented (not object-oriented) interface. No functions are exported by default. At present, there are two functions which are exportable: roll and roll_array. The latter is used internally by roll, but can also be exported by itself.
The number and type of dice to roll is given in a style which should be familiar to players of popular role-playing games: adb[+-*/b]c. a is optional and defaults to 1; it gives the number of dice to roll. b indicates the number of sides to each die; the most common, cube-shaped die is thus a d6. % can be used instead of 100 for b; hence, rolling 2d% and 2d100 is equivalent. roll simulates a rolls of b-sided dice and adds together the results.
The optional end, consisting of one of +-*/b and a number c, can modify the sum of the individual dice. +-*/ are similar in that they take the sum of the rolls and add or subtract c, or multiply or divide the sum by c. (x can also be used instead of *.) Hence, 1d6+2 gives a number in the range 3..8, and 2d4*10 gives a number in the range 20..80. (Using / truncates the result to an int after dividing.) Using b in this slot is a little different: its short for "best" and indicates "roll a number of dice, but add together only the best few". For example, 5d6b3 rolls five six- sided dice and adds together the three best rolls. This is sometimes used, for example, in roll-playing to give higher averages.
Generally, roll probably provides the nicer interface, since it does the adding up itself. However, in some situations one may wish to process the individual rolls (for example, I am told that in the game Feng Shui, the number of dice to be rolled cannot be determined in advance but depends on whether any 6s were rolled); in such a case, one can use roll_array to return an array of values, which can then be examined or processed in an application-dependent manner.
This having been said, comments and additions (especially if accompanied by code!) to Games::Dice are welcome. So, using the above example, if anyone wishes to contribute a function along the lines of roll_feng_shui to become part of Games::Dice (or to support any other style of die rolling), you can contribute it to the authors address, listed below.
Download (0.004MB)
Added: 2007-07-25 License: Perl Artistic License Price:
821 downloads
Games::Cards 1.45
Games::Cards is a Perl module for writing and playing card games. more>>
Games::Cards is a Perl module for writing and playing card games.
SYNOPSIS
use Games::Cards;
my $Rummy = new Games::Cards::Game;
# Create the correct deck for a game of Rummy.
my $Deck = new Games::Cards::Deck ($Rummy, "Deck");
# shuffle the deck and create the discard pile
$Deck->shuffle;
my $Discard = new Games::Cards::Queue "Discard Pile";
# Deal out the hands
foreach my $i (1 .. 3) {
my $hand = new Games::Cards::Hand "Player $i" ;
$Deck->give_cards($hand, 7);
$hand->sort_by_value;
push @Hands, $hand;
}
# print hands (e.g. "Player 1: AS 2C 3C 3H 10D QS KH")
foreach (@Hands) { print ($_->print("short"), "n") }
$Hands[1]->give_a_card ($Discard, "8D"); # discard 8 of diamonds
This module creates objects and methods to allow easier programming of card games in Perl. It allows you to do things like create decks of cards, have piles of cards, hands, and other sets of cards, turn cards face-up or face-down, and move cards from one set to another. Which is pretty much all you need for most card games.
<<lessSYNOPSIS
use Games::Cards;
my $Rummy = new Games::Cards::Game;
# Create the correct deck for a game of Rummy.
my $Deck = new Games::Cards::Deck ($Rummy, "Deck");
# shuffle the deck and create the discard pile
$Deck->shuffle;
my $Discard = new Games::Cards::Queue "Discard Pile";
# Deal out the hands
foreach my $i (1 .. 3) {
my $hand = new Games::Cards::Hand "Player $i" ;
$Deck->give_cards($hand, 7);
$hand->sort_by_value;
push @Hands, $hand;
}
# print hands (e.g. "Player 1: AS 2C 3C 3H 10D QS KH")
foreach (@Hands) { print ($_->print("short"), "n") }
$Hands[1]->give_a_card ($Discard, "8D"); # discard 8 of diamonds
This module creates objects and methods to allow easier programming of card games in Perl. It allows you to do things like create decks of cards, have piles of cards, hands, and other sets of cards, turn cards face-up or face-down, and move cards from one set to another. Which is pretty much all you need for most card games.
Download (0.089MB)
Added: 2007-01-03 License: Perl Artistic License Price:
1034 downloads
Games::Score 0.02
Games::Score is a Perl module to keep track of score in games . more>>
Games::Score is a Perl module to keep track of score in games .
SYNOPSIS
use Games::Score;
# these three values are the default ones, by the way
Games::Score->default_score(0);
Games::Score->default_step(1);
Games::Score->step_method(inc);
# start two players
my $player1 = Games::Score->new();
my $player2 = Games::Score->new();
# set a winning condition
Games::Score->victory_is( sub { $_[0] >= 20 } );
# and something to do if it is achieved
Games::Score->on_victory_do( sub { print "Won!" } );
# give points to the players
$player1->add(2);
$player2->step();
# look at section FUNCTIONS for more functionalities, such as
Games::Score->invalidate_if( sub { $_[0] > 20 } );
Games::Score can be use to keep track of several players points in a game, regardless of the starting amount of points, winning and/or losing conditions, etc.
It provides several useful methods so that the user doesnt have to keep testing values to see if theyre valid or if the player condition has changed.
<<lessSYNOPSIS
use Games::Score;
# these three values are the default ones, by the way
Games::Score->default_score(0);
Games::Score->default_step(1);
Games::Score->step_method(inc);
# start two players
my $player1 = Games::Score->new();
my $player2 = Games::Score->new();
# set a winning condition
Games::Score->victory_is( sub { $_[0] >= 20 } );
# and something to do if it is achieved
Games::Score->on_victory_do( sub { print "Won!" } );
# give points to the players
$player1->add(2);
$player2->step();
# look at section FUNCTIONS for more functionalities, such as
Games::Score->invalidate_if( sub { $_[0] > 20 } );
Games::Score can be use to keep track of several players points in a game, regardless of the starting amount of points, winning and/or losing conditions, etc.
It provides several useful methods so that the user doesnt have to keep testing values to see if theyre valid or if the player condition has changed.
Download (0.007MB)
Added: 2006-12-27 License: Perl Artistic License Price:
1031 downloads
Games::Battleship 0.05
Games::Battleship - You sunk my battleship! more>>
Games::Battleship - "You sunk my battleship!"
SYNOPSIS
use Games::Battleship;
$g = Games::Battleship->new(qw( Gene Aeryk ));
$g->add_player(Stephanie);
$winner = $g->play();
print $winner->name(), " wins!n";
@player_objects = @{ $g->players };
$player_obj = $g->player(Professor Snape);
A Games::Battleship object represents a battleship game between players. Each has a fleet of vessles and operates with a pair of playing grids One is for their own fleet and one for where the enemy has been seen.
Everything is an object with default but mutable attributes. This way games can have two or more players each with a single fleet of custom vessles. These vessles are pretty simple and standard right now...
A game can be played with the handy play() method or for finer control, use individual methods of the Games::Battleship::* modules. See the distribution test script for working code examples.
<<lessSYNOPSIS
use Games::Battleship;
$g = Games::Battleship->new(qw( Gene Aeryk ));
$g->add_player(Stephanie);
$winner = $g->play();
print $winner->name(), " wins!n";
@player_objects = @{ $g->players };
$player_obj = $g->player(Professor Snape);
A Games::Battleship object represents a battleship game between players. Each has a fleet of vessles and operates with a pair of playing grids One is for their own fleet and one for where the enemy has been seen.
Everything is an object with default but mutable attributes. This way games can have two or more players each with a single fleet of custom vessles. These vessles are pretty simple and standard right now...
A game can be played with the handy play() method or for finer control, use individual methods of the Games::Battleship::* modules. See the distribution test script for working code examples.
Download (0.010MB)
Added: 2006-12-27 License: Perl Artistic License Price:
1035 downloads
Games::Lineofsight 1.0
Games::Lineofsight is a Perl module. more>>
Games::Lineofsight is a Perl module.
Many games (Ultima, Nethack) use two-dimensional maps that consists of the squares of the same size in a grid. Line-of-sight means that some of the squares may represent the items that block the vision of the player from seeing squares behind them. With this module you can add that behaviour to your games.
SYNOPSIS
use Games::Lineofsight qw(lineofsight);
# The map has to be a two-dimensional array. Each member (or "cell") of the array represents one
# square in the map. In this example each cell contains only one character but you can put strings
# to the cells also - practical with the graphical games.
my @map=(
[split //,"..:..::........."], # this is the map
[split //,".......:..X....:"], # . and : represents the ground
[split //,"...X.....:...:.."], # X is the barrier for the sight
[split //,".:...:....:....."],
[split //,"..X....:..X....."],
[split //,"..X..:........:."],
);
my($width)=scalar(@{@map[0]}); # the width of the map
my($height)=scalar(@map); # the height of the map
my($barrier_str)="X"; # string that represents the barrier
my($hidden_str)="*"; # string that represents a cell behind a barrier
my($man_str)="@"; # string that represents the viewer
my($man_x,$man_y)=(7,3); # view point coordinates - the player is here
# recreate the map with line-of-sight
@map=lineofsight(@map,$man_x,$man_y,$barrier_str,$hidden_str);
# draw the map
for(my $i=0;$i < $height;$i++){
for(my $j=0;$j < $width;$j++){
print $man_x == $j && $man_y == $i ? $man_str : $map[$i][$j];
}
print "n";
}
or
# The lineofsight() calls get_barriers() and analyze_map() each time its called. If the viewer
# moves around the map a lot, its much faster to read in the barriers once and call only
# analyze_map() each time before drawing it.
use Games::Lineofsight qw(get_barriers analyze_map);
# The map has to be a two-dimensional array. Each member (or "cell") of the array represents one
# square in the map. In this example each cell contains only one character but you can put strings
# to the cells also - practical with the graphical games.
my @map=(
[split //,"..:..::........."], # this is the map
[split //,".......:..X....:"], # . and : represents the ground
[split //,"...X.....:...:.."], # X is the barrier for the sight
[split //,".:...:....:....."],
[split //,"..X....:..X....."],
[split //,"..X..:........:."],
);
my($width)=scalar(@{@map[0]}); # the width of the map
my($height)=scalar(@map); # the height of the map
my($barrier_str)="X"; # string that represents the barrier
my($hidden_str)="*"; # string that represents a cell behind a barrier
my($man_str)="@"; # string that represents the viewer
my($man_x,$man_y)=(7,3); # view point coordinates - the player is here
# get_barriers() returns a hash with the information about barriers in the map. In this example we
# declare the "X"-character as a barrier. As well you can declare it to be a string in the graphical
# games; for example "barrier.jpg".
my %barrier=get_barriers($width,$height,@map,$barrier_str);
# analyze_map() returns an array containing the original map looked from the view point. The cells
# behind the barriers are replaced with given strings. The barriers should be told to the subroutine
# calling first get_barriers()-subroutine as we already did.
my @map2=analyze_map($width,$height,@map,%barrier,$man_x,$man_y,$hidden_str);
#draw the map with the lineofsight
print "nOriginal map:n";
draw($width,$height,$man_x,$man_y,@map2,$man_str);
# move the viewer two squares right
$man_x+=2;
# refresh the map
my @map2=analyze_map($width,$height,@map,%barrier,$man_x,$man_y,$hidden_str);
#draw the map again
print "nViewer has moved:n";
draw($width,$height,$man_x,$man_y,@map2,$man_str);
sub draw{
my($width,$height,$man_x,$man_y,$map,$man_str)=@_;
for(my $i=0;$i < $height;$i++){
for(my $j=0;$j < $width;$j++){
print $man_x == $j && $man_y == $i ? $man_str : $$map[$i][$j];
}
print "n";
}
}
<<lessMany games (Ultima, Nethack) use two-dimensional maps that consists of the squares of the same size in a grid. Line-of-sight means that some of the squares may represent the items that block the vision of the player from seeing squares behind them. With this module you can add that behaviour to your games.
SYNOPSIS
use Games::Lineofsight qw(lineofsight);
# The map has to be a two-dimensional array. Each member (or "cell") of the array represents one
# square in the map. In this example each cell contains only one character but you can put strings
# to the cells also - practical with the graphical games.
my @map=(
[split //,"..:..::........."], # this is the map
[split //,".......:..X....:"], # . and : represents the ground
[split //,"...X.....:...:.."], # X is the barrier for the sight
[split //,".:...:....:....."],
[split //,"..X....:..X....."],
[split //,"..X..:........:."],
);
my($width)=scalar(@{@map[0]}); # the width of the map
my($height)=scalar(@map); # the height of the map
my($barrier_str)="X"; # string that represents the barrier
my($hidden_str)="*"; # string that represents a cell behind a barrier
my($man_str)="@"; # string that represents the viewer
my($man_x,$man_y)=(7,3); # view point coordinates - the player is here
# recreate the map with line-of-sight
@map=lineofsight(@map,$man_x,$man_y,$barrier_str,$hidden_str);
# draw the map
for(my $i=0;$i < $height;$i++){
for(my $j=0;$j < $width;$j++){
print $man_x == $j && $man_y == $i ? $man_str : $map[$i][$j];
}
print "n";
}
or
# The lineofsight() calls get_barriers() and analyze_map() each time its called. If the viewer
# moves around the map a lot, its much faster to read in the barriers once and call only
# analyze_map() each time before drawing it.
use Games::Lineofsight qw(get_barriers analyze_map);
# The map has to be a two-dimensional array. Each member (or "cell") of the array represents one
# square in the map. In this example each cell contains only one character but you can put strings
# to the cells also - practical with the graphical games.
my @map=(
[split //,"..:..::........."], # this is the map
[split //,".......:..X....:"], # . and : represents the ground
[split //,"...X.....:...:.."], # X is the barrier for the sight
[split //,".:...:....:....."],
[split //,"..X....:..X....."],
[split //,"..X..:........:."],
);
my($width)=scalar(@{@map[0]}); # the width of the map
my($height)=scalar(@map); # the height of the map
my($barrier_str)="X"; # string that represents the barrier
my($hidden_str)="*"; # string that represents a cell behind a barrier
my($man_str)="@"; # string that represents the viewer
my($man_x,$man_y)=(7,3); # view point coordinates - the player is here
# get_barriers() returns a hash with the information about barriers in the map. In this example we
# declare the "X"-character as a barrier. As well you can declare it to be a string in the graphical
# games; for example "barrier.jpg".
my %barrier=get_barriers($width,$height,@map,$barrier_str);
# analyze_map() returns an array containing the original map looked from the view point. The cells
# behind the barriers are replaced with given strings. The barriers should be told to the subroutine
# calling first get_barriers()-subroutine as we already did.
my @map2=analyze_map($width,$height,@map,%barrier,$man_x,$man_y,$hidden_str);
#draw the map with the lineofsight
print "nOriginal map:n";
draw($width,$height,$man_x,$man_y,@map2,$man_str);
# move the viewer two squares right
$man_x+=2;
# refresh the map
my @map2=analyze_map($width,$height,@map,%barrier,$man_x,$man_y,$hidden_str);
#draw the map again
print "nViewer has moved:n";
draw($width,$height,$man_x,$man_y,@map2,$man_str);
sub draw{
my($width,$height,$man_x,$man_y,$map,$man_str)=@_;
for(my $i=0;$i < $height;$i++){
for(my $j=0;$j < $width;$j++){
print $man_x == $j && $man_y == $i ? $man_str : $$map[$i][$j];
}
print "n";
}
}
Download (0.004MB)
Added: 2007-01-03 License: Perl Artistic License Price:
1029 downloads
Games Knoppix 4.0.2-03
Games Knoppix is a Knoppix based LiveCD with games. more>>
Games Knoppix is a Knoppix based LiveCD with games.
The following games are included:
- Marble Blast Gold Demo (OpenGL)
- Mutant Storm Demo (OpenGL)
- Space Tripper Demo (OpenGL)
- Think Tanks Demo (OpenGL)
- Ufo AI (XMas Special) (OpenGL)
- Asciijump
- Atanks
- Bzflag (OpenGL)
- Bzflag-Server
- Crack-Attack (OpenGL)
- Crimson
- Crossfire-Client-GTK
- Crossfire-Client-X11
- Cube
- Empire
- Enigma
- Foobillard (OpenGL)
- Freeciv-Client
- Freeciv-Client-GTK
- Freeciv-Server
- Freesci
- Gltron (OpenGL)
- Gnuchess
- Gnugo
- JumpnBump
- Kbattleship
- Kmahjongg
- Kobodeluxe
- Ksokoban
- Lbreakout2
- Lgeneral
- Nethack-Console
- Nethack-Gnome
- Nethack-Lisp
- Nethack-Qt
- Nethack-X11
- Netpanzer (OpenGL)
- Neverball (OpenGL)
- Pysol
- Scorched3d (OpenGL)
- Tower Toppler
- Battle for Wesnoth
- Battle for Wesnoth Editor
- Battle for Wesnoth Server
- Xarchon
- Xblast
- Xblast-TNT
- Xboing
- Xgalaga
- Xskat
- Xsoldier
<<lessThe following games are included:
- Marble Blast Gold Demo (OpenGL)
- Mutant Storm Demo (OpenGL)
- Space Tripper Demo (OpenGL)
- Think Tanks Demo (OpenGL)
- Ufo AI (XMas Special) (OpenGL)
- Asciijump
- Atanks
- Bzflag (OpenGL)
- Bzflag-Server
- Crack-Attack (OpenGL)
- Crimson
- Crossfire-Client-GTK
- Crossfire-Client-X11
- Cube
- Empire
- Enigma
- Foobillard (OpenGL)
- Freeciv-Client
- Freeciv-Client-GTK
- Freeciv-Server
- Freesci
- Gltron (OpenGL)
- Gnuchess
- Gnugo
- JumpnBump
- Kbattleship
- Kmahjongg
- Kobodeluxe
- Ksokoban
- Lbreakout2
- Lgeneral
- Nethack-Console
- Nethack-Gnome
- Nethack-Lisp
- Nethack-Qt
- Nethack-X11
- Netpanzer (OpenGL)
- Neverball (OpenGL)
- Pysol
- Scorched3d (OpenGL)
- Tower Toppler
- Battle for Wesnoth
- Battle for Wesnoth Editor
- Battle for Wesnoth Server
- Xarchon
- Xblast
- Xblast-TNT
- Xboing
- Xgalaga
- Xskat
- Xsoldier
Download (2762MB)
Added: 2005-09-14 License: GPL (GNU General Public License) Price:
857 downloads
Games::Bingo::Bot 0.01
Games::Bingo::Bot is a simple class holding IRC related methods for bingo. more>>
Games::Bingo::Bot is a simple class holding IRC related methods for bingo.
SYNOPSIS
use Games::Bingo::Bot;
use constant ANY => 1; use constant PUBLIC => 2; use constant PRIVATE => 3;
my $gbb = Games::Bingo::Bot->new();
my $sub = $gbb->{commands}->{$msg});
my ($type, $answer) = &$sub($gbb, $nick);
This module contains all the commands supported by the Games::Bingo::Bot IRC bot (see the script in the bin directory).
The Games::Bingo::Bot class (this) and the script mentioned above is a complete IRC setup for playing Bingo, using the Games::Bingo module.
These are the bingobot commands:
help - this message
play - join a game
stats - get the current statistics of the running game
pull - pull the next number
bingo - you indicate to the bot that you have bingo
pulled - shows you what number have been pulled
show - lists the numbers on your plate
The command are described below in detail (SEE COMMANDS).
Not implemented yet (SEE TODO):
auto - enables automode (automatic number pulling)
noauto - disables automode
All commands can be sent into the channel or send as private messages to the bot. The bot can repond as both of these ways aswell. The reponses are sent as follows:
help, show and all errors are always private messages
pull and bingo are always public
play, pulled, stats, auto, noauto depends on how you query
As long as the bot is online a game is running.
<<lessSYNOPSIS
use Games::Bingo::Bot;
use constant ANY => 1; use constant PUBLIC => 2; use constant PRIVATE => 3;
my $gbb = Games::Bingo::Bot->new();
my $sub = $gbb->{commands}->{$msg});
my ($type, $answer) = &$sub($gbb, $nick);
This module contains all the commands supported by the Games::Bingo::Bot IRC bot (see the script in the bin directory).
The Games::Bingo::Bot class (this) and the script mentioned above is a complete IRC setup for playing Bingo, using the Games::Bingo module.
These are the bingobot commands:
help - this message
play - join a game
stats - get the current statistics of the running game
pull - pull the next number
bingo - you indicate to the bot that you have bingo
pulled - shows you what number have been pulled
show - lists the numbers on your plate
The command are described below in detail (SEE COMMANDS).
Not implemented yet (SEE TODO):
auto - enables automode (automatic number pulling)
noauto - disables automode
All commands can be sent into the channel or send as private messages to the bot. The bot can repond as both of these ways aswell. The reponses are sent as follows:
help, show and all errors are always private messages
pull and bingo are always public
play, pulled, stats, auto, noauto depends on how you query
As long as the bot is online a game is running.
Download (0.006MB)
Added: 2007-01-02 License: Perl Artistic License Price:
1032 downloads
Games::Euchre::AI 1.02
Games::Euchre::AI is a Player API for Euchre card game. more>>
Games::Euchre::AI is a Player API for Euchre card game.
This class implements a skeletal Euchre player programming interface. Subclasses can be created quite easily as interactive interfaces or AI computer players.
If you wish to write your own computer player, I recommend you start with Games::Euchre::AI::Simple. If you wish to write your own human interface, I recommend you start with Games::Euchre::AI::Human.
CLASS METHODS
new
Create and initialize a new Euchre AI. This object is implemented as an empty hash. Subclasses may wish to use this hash for state storage.
INSTANCE METHODS
Actions
The following methods are called in the course of the game where the AI (or human) has to make a decision. The state of the game is always passed in a hashreference. The following fields are always available:
name is the name of the current player. This is useful for output messages.
names is a hash relating player number to player name for all four players.
debug is a boolean indicating if we are debugging game or the AIs. Your AI may wish to provide verbose output if debugging is going on.
bid STATEHASH
Choose trump or pass. The relevent details of the current state of the game are provided in a hash reference. Here is an example of that data structure:
{
name => Player 1,
names => {1 => Player 1, 2 => P2, 3 => P3, 4 => Fred},
number => 1,
turnedUp => KH,
passes => 1,
ourScore => 2,
theirScore => 4,
winScore => 10,
hangdealer => false,
notrump => false,
hand => [JS, QH, 9S, KC, AD],
debug => false,
}
turnedUp is the suit and value of the card on the top of the blind. This will be undef on the second round of bidding.
passes says how many people have passed so far
hangdealer is a boolean saying whether the hang-the-dealer optional rule is in effect
notrump is a boolean saying whether the no trump optional rule is in effect
This function must return one of: H, D, C, S, N, HA, DA, CA, SA, NA, or undef
N means no trump, A means alone, undef means pass. Not all of these are legal at any given round! Use the isLegalBid() method below if you are unsure.
pickItUp STATEHASH
If this is called, you are the dealer and someone called trump. Choose which card from your hand to discard in exchange for the top card of the blind. The relevent details of the current state of the game are provided in a hash reference. Here is an example of that data structure:
{
name => Player 1,
names => {1 => Player 1, 2 => P2, 3 => P3, 4 => Fred},
number => 1,
turnedUp => KH,
trump => H,
bidder => 2,
weBid => false,
usAlone => false,
themAlone => false,
hand => [JS, QH, 9S, KC, AD],
debug => false,
}
This method should return the 0-based index of the card to trade for the turnedUp card. Namely, this in the index of the hand array for the card that you choose.
playCard STATEHASH
Choose which card from your hand to play on this trick. The relevent details of the current state of the game are provided in a hash reference. Here is an example of that data structure:
{
name => Player 1,
names => {1 => Player 1, 2 => P2, 3 => P3, 4 => Fred},
number => 1,
trump => H,
bidder => 2,
weBid => true,
usAlone => false,
themAlone => false,
trick => 2,
ourTricks => 0,
theirTricks => 1,
ourScore => 2,
theirScore => 4,
winScore => 10,
played => [10H, 9H, QC],
playedBy => [2, 3, 4, 1],
hand => [JH, AH, AS, KS],
debug => false,
}
playedBy is an arrayref of numbers of the players in the order they will play. Without this, the alone possibility makes it hard to tell who played what.
Any needed information not stored here (like who was the dealer, what was the turn-up card, what happened in the first trick) is YOUR responsibility to collect and store in your instance.
This method should return the 0-based index of the card to play. Namely, this in the index of the hand array for the card that you choose.
<<lessThis class implements a skeletal Euchre player programming interface. Subclasses can be created quite easily as interactive interfaces or AI computer players.
If you wish to write your own computer player, I recommend you start with Games::Euchre::AI::Simple. If you wish to write your own human interface, I recommend you start with Games::Euchre::AI::Human.
CLASS METHODS
new
Create and initialize a new Euchre AI. This object is implemented as an empty hash. Subclasses may wish to use this hash for state storage.
INSTANCE METHODS
Actions
The following methods are called in the course of the game where the AI (or human) has to make a decision. The state of the game is always passed in a hashreference. The following fields are always available:
name is the name of the current player. This is useful for output messages.
names is a hash relating player number to player name for all four players.
debug is a boolean indicating if we are debugging game or the AIs. Your AI may wish to provide verbose output if debugging is going on.
bid STATEHASH
Choose trump or pass. The relevent details of the current state of the game are provided in a hash reference. Here is an example of that data structure:
{
name => Player 1,
names => {1 => Player 1, 2 => P2, 3 => P3, 4 => Fred},
number => 1,
turnedUp => KH,
passes => 1,
ourScore => 2,
theirScore => 4,
winScore => 10,
hangdealer => false,
notrump => false,
hand => [JS, QH, 9S, KC, AD],
debug => false,
}
turnedUp is the suit and value of the card on the top of the blind. This will be undef on the second round of bidding.
passes says how many people have passed so far
hangdealer is a boolean saying whether the hang-the-dealer optional rule is in effect
notrump is a boolean saying whether the no trump optional rule is in effect
This function must return one of: H, D, C, S, N, HA, DA, CA, SA, NA, or undef
N means no trump, A means alone, undef means pass. Not all of these are legal at any given round! Use the isLegalBid() method below if you are unsure.
pickItUp STATEHASH
If this is called, you are the dealer and someone called trump. Choose which card from your hand to discard in exchange for the top card of the blind. The relevent details of the current state of the game are provided in a hash reference. Here is an example of that data structure:
{
name => Player 1,
names => {1 => Player 1, 2 => P2, 3 => P3, 4 => Fred},
number => 1,
turnedUp => KH,
trump => H,
bidder => 2,
weBid => false,
usAlone => false,
themAlone => false,
hand => [JS, QH, 9S, KC, AD],
debug => false,
}
This method should return the 0-based index of the card to trade for the turnedUp card. Namely, this in the index of the hand array for the card that you choose.
playCard STATEHASH
Choose which card from your hand to play on this trick. The relevent details of the current state of the game are provided in a hash reference. Here is an example of that data structure:
{
name => Player 1,
names => {1 => Player 1, 2 => P2, 3 => P3, 4 => Fred},
number => 1,
trump => H,
bidder => 2,
weBid => true,
usAlone => false,
themAlone => false,
trick => 2,
ourTricks => 0,
theirTricks => 1,
ourScore => 2,
theirScore => 4,
winScore => 10,
played => [10H, 9H, QC],
playedBy => [2, 3, 4, 1],
hand => [JH, AH, AS, KS],
debug => false,
}
playedBy is an arrayref of numbers of the players in the order they will play. Without this, the alone possibility makes it hard to tell who played what.
Any needed information not stored here (like who was the dealer, what was the turn-up card, what happened in the first trick) is YOUR responsibility to collect and store in your instance.
This method should return the 0-based index of the card to play. Namely, this in the index of the hand array for the card that you choose.
Download (0.021MB)
Added: 2006-12-26 License: Perl Artistic License Price:
1034 downloads
Secleted [ 0 ] software to compare
Copyright Notice:
Software piracy is theft, Using crack, password, serial numbers, registration codes, key generators is illegal and prevent future software development. The above games pain search only lists software in full, demo and trial versions for free download. Download links are directly from our mirror sites or publisher sites, torrent files or links from rapidshare.com, yousendit.com or megaupload.com are not allowed