mscerts.net
 
Adaptive Technologies
Adobe AIR Apps
Artistic Software
Communications
Database
Desktop Environment
Documentation
Education
Games
Home Automation
Information Management
Internet
Multimedia
Office
Printing
Programming
Religion
Science
Science and Engineering
Security
System
Terminals
Text Editing&Processing
Utilities
 
 
myGengo 1.2.0
corejet.jira 1.0 Alpha 1
jsoncmd 0.0
correct_pycountry 0.12.2
Monsters 1.0
corejet.core 1.0 Alpha 1
Scope::Container::DBI 0.04
DBIx::DataModel 1.27
Word Golf 0.2.1
Plack::Middleware::LogWarn 0.001002
 
 
 

Games::Wumpus 2009112401

Play Hunt the Wumpus

Games::Wumpus is a Perl module that can be used to play a game of Hunt the Wumpus. It will keep state, perform action, and deduce whether a game is won or lost.

The following methods are available:

new

 Class methods that returns an uninitialized object.

init

 Initializes an object. Creates a Games::Wumpus::Cave object, fills the players quiver with arrows, and places the player at the start location. Returns the initialized object.

cave

 Accessor returning the cave used in the current game.
item

 Accessor returning the number of arrows.

lose_arrow

 Accessor to reduce the number of arrows by one.

finished

 Accessor returning the win/lose state of the game. If an undefined value is returned, the game isn't finished yet. A false but defined value means the player has lost the game (eaten by the Wumpus, fallen in a pit, shot by an arrow, ran out of arrows). A true value means the game was won (the Wumpus was shot).

win

 Accessor setting a win for the player.

lose

 Accessor setting the game lost for the player.

describe

 Returns a string describing where the player is in the cave, the tunnels leading from the current location, any hints regarding nearby hazards, and the number of arrows left.

move

 Takes a new location as argument. It assumes the argument is well formatted - that is, exactly one, defined, argument is parsed. Returns a status and a list of strings. If the player cannot move to the specified location 0 is returned as status, and the reason why as a string. Otherwise 1 is returned, and a (possibly empty) list of strings describing encounters with hazards. If the Wumpus or a pit is encountered, the game is declared a loss.

shoot

 Takes a list (1 to 5) of locations as argument -- the path a shot arrow must follow. It assumes the argument is well formatted, 1 to 5 defined values. Returns a status and a list of strings. If the shot cannot be performed (no arrows, path goes through the same tunnel twice in succession, first location isn't connected to current location), 0 and the reason why the shot cannot be performed is returned as status and list of strings. Otherwise, 1 is returned, and list of strings describing interesting events. If the Wumpus is shot, the game is won. If the player is shot, the game is lost. Shooting an arrow may cause the Wumpus to move (and eat you).

SYNOPSIS

 my $game = Games::Wumpus -> new -> init;

 while (!defined $game -> finished) {
 ($status, @messages) = $game -> move ($someplace);
 say for @messages;
 ($status, @messages) = $game -> shoot (@somewhere);
 say for @messages;
 }

 if ($game -> finished) {say "Won!"}
 else {say "Lost!"}

Requirements:

· Perl

  Other
-   ToPIA 2.4.2
-   Beanfabrics 0.7.8
-   ucltip 0.1
-   Datarray 0.0.3
-   junixsocket 1.2
-   PyAyaByAya 0.1
-   PyCorpus 0.1
-   Alfanous 0.2
-   Template::Plugin::HTML::Prototype 0.01
-   Class::Method::Auto 1.00
-   Catalyst::Plugin::Config::YAML 0.04
-   NCBIx::BigFetch 0.56
-   Crypt::Ctr 0.01
-   Crypt::CFB 0.01
-   CosmoloPy 0.1.001
-   altgraph 0.7.0
-   CodeTalker 1.0
-   modulegraph 0.8
-   Shabti 0.4
-   rivr 0.1.1
 
 
                mscerts.net