Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked
 
PerlMonks  

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

by pjf (Curate)
on May 24, 2008 at 05:41 UTC ( [id://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.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others exploiting the Monastery: (2)
As of 2025-05-18 00:55 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?
    erzuuliAnonymous Monks are no longer allowed to use Super Search, due to an excessive use of this resource by robots.