Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW
 
PerlMonks  

Re^2: App::SweeperBot - Perl plays minesweeper, automatically.

by pjf (Curate)
on May 24, 2008 at 05:41 UTC ( #688258=note: print w/ replies, xml ) Need Help??


in reply to Re: App::SweeperBot - Perl plays minesweeper, automatically.
in thread App::SweeperBot - Perl plays minesweeper, automatically.

A new release (0.03) of App::SweeperBot is being uploaded to the CPAN as I write this.

The new version uses a simple OO design from which you should be able to inherit cleanly. If you want to replace the AI, it should be as simple as:

package App::SweeperBot::Smarter; use base qw(App::SweeperBot); sub make_move { my ($this, $game_state) = @_; # Your AI goes here. } 1;

You can find what's in a given square using $game_state->[$x][$y]. Note that App::SweeperBot considers (1,1) to be the top-left square (not (0,0)).

The new release has all entire API documented; there are methods for stepping on squares, flagging squares, stomping (middle-clicking) on squares, and a few helpers for things like "how many unknown mines are adjacent to this square"?

Feedback, questions, and criticism all welcome.


Comment on Re^2: App::SweeperBot - Perl plays minesweeper, automatically.
Download Code

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://688258]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others studying the Monastery: (9)
As of 2014-10-01 08:29 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    How do you remember the number of days in each month?











    Results (390 votes), past polls