App-SweeperBot

 view release on metacpan or  search on metacpan

lib/App/SweeperBot.pm  view on Meta::CPAN

Returns C<1> for game over due to a win, C<-1> for game over due to
a loss, and false if the game has not finished.

=cut

# Is the game over (we hit a mine)? 
# Returns -1 if game is over and we lost, 0 if not over, 1 if over and we won
sub game_over {
    # Capture game button and determine its sig
    # Game button is always at (x,56). X-value must be determined by 
    # calculation using formula: x=w/2-11
    # Size is 26x26
    our($l,$t,$w);

    # If we don't know where our smiley lives, then go find it.
    if (not $Smiley_offset) {
        for (my $i = MINIMUM_TOP_DRESSING; $i <= MAXIMUM_TOP_DRESSING; $i++) {

	    $Smiley_offset = $i;

            warn "Searching $Smiley_offset pixels down for smiley\n" if DEBUG;



( run in 0.756 second using v1.01-cache-2.11-cpan-3cd7ad12f66 )