Jump to content

Minefield


vonc
 Share

Recommended Posts

Ok, I take your cue... :)

After Hangman, I guess you are only interested in little games... :D

So here it is, just for you:

Minefield

A few lines, no pictures, so just copy the script (see attached file), launch it and enjoy

--

Edit 25/04 08:06:

* add in Func _buildButtons($anarray_buttons) the lines

GUICtrlSetFont ($afield,9, 800) ; Bold

GUICtrlSetColor($afield,0x00ff00) ; Green

, in order to have the number of mines on a button (explored field) displayed in bold, as requested by Smed

Rq: the GUICtrlSetColor does not work for a button... but may be it will someday!

Edit 25/04 13:50:

* _displayaround is no more a recursive function, in order to avoid the "Recursion level has been exceeded" reported by Burrup

* the number of mines can not exceed nbrow * nbcol (thanks Burrup)

Edit 25/04 23:26:

* Minefield 2.0

This time... the clock is ticking

Edit 26/04 08:15:

* Minefield 2.1 *

- The clicking clock mercifully stop when the window is not active

(that is when you quickly hide it from your boss behind your excel spreadsheet :D )

- A couple of GUICtrlSetResizing have been added to keep all fields in place in case of window resizing

Edit 27/04 08:12:

* Minefield 3.0 *

- This time... the clock can also count *down*

(you can switch between clock and countdown mode at any time by clicking the checkbutton near the clock)

(in countdown mode, you can enter a time you want to beat)

It the countdown reaches 0 second... KABOOM)

Edit 29/04 17:30:

* Minefield 4.0 *

- hints: the explored fields (button with number) which can be automatically completed (either by flags other explored fields on their immediate adjacent fields) are underlined to be more visible.

You can select your more: no easy fill, easy fill but no hints, easy fill with hints (default mode)

minefield.au3

Edited by vonc

-- VonCMinefield

Link to comment
Share on other sites

:) This is amazing! Definatley one for the books :D For those of you who just got here, I've attatched the same script with quotations around the true and false words... Looks like he forgot to add them :D
FootbaG
Link to comment
Share on other sites

Nice... I love the little games. I find it dificult however to quickly evaluate the numbers on the buttons. I think this is because I'm used to the numbers being bold and colored.

601DisengageEnd Program

Link to comment
Share on other sites

:) This is amazing! Definatley one for the books :D For those of you who just got here, I've attatched the same script with quotations around the true and false words... Looks like he forgot to add them :D

<{POST_SNAPBACK}>

Thank you layer, but that script is intended to run with latest beta version of Autoit, as specified in the beginning of the script.

In that beta version, true and false are keywords (since 15th April 2005 - v3.1.1.7)

In older version, with '' around true and false, I am not sure of the result, especially for the 'easy fill' mode...

-- VonCMinefield

Link to comment
Share on other sites

I set the # of mines to 1, with a W and H of 20x40. Had 799 fields. I clicked on an a field, empty one, and it started to delete all the empty ones its connected to and it got to

418/799 fields and I got.

$anbmines = _getnbmines($rr, $cc)

Error: Recursion level has been exceeded - AutoIt will quit to prevent stack overflow.

Recommend having a maximum Width and Height.

And when you have more mines than fields AutoIt "locks-up".

qq

Link to comment
Share on other sites

I set the # of mines to 1, with a W and H of 20x40. Had 799 fields. I clicked on an a field, empty one, and it started to delete all the empty ones its connected to and it got to

418/799 fields and I got.

$anbmines = _getnbmines($rr, $cc)

Error: Recursion level has been exceeded - AutoIt will quit to prevent stack overflow.

Recommend having a maximum Width and Height.

Hi Burrupt:

The number of rows and cols are limited (to 50 max), but the recursive problem is real (and has been corrected, see script in the first message, edited today)

And when you have more mines than fields AutoIt "locks-up".

<{POST_SNAPBACK}>

Corrected.

-- VonCMinefield

Link to comment
Share on other sites

Damn, I gotta keep up with these new BETA's... It's just they've been adding so much, it's hard to keep track and DL it all... :) Also, I think adding the bold numbers was a good idea because as Smed said, I too am used to the bold numbers... Nice addition :D

FootbaG
Link to comment
Share on other sites

Ok Gents...

Minefield 2.0 is up, and the clock is ticking.

(cf. script in first message of this thread)

I am down to (103 wait no,edit:) 78 seconds with the default settings (35 mines on a 10*20 field, with the 'easy fill' mode activated) :)

That can not be the fastest time ever, right ? :D

Right ? :D

Anyone ? :huh:

Edited by vonc

-- VonCMinefield

Link to comment
Share on other sites

Relly nice !

I've tested it on Windows 2000 and it works perfectly, except for that the timer

is drawn over by the buttons when height is >10 ..

<{POST_SNAPBACK}>

Hi Helge,

Are you sure you got the *last* version of the script ?

I had to reedit it in a rush to add the

GUICtrlSetResizing($Label_clock, $GUI_DOCKALL)
line (86) allowing for the clock to not move when height change!

-- VonCMinefield

Link to comment
Share on other sites

Hello,

Minefield 2.1 is up

This time you can pause the clock by hidding the window: if the minefield window is not active, its clock pauses :D

And hidding this minefield window is something that could come in handy real quick, isn't it ? :)

-- VonCMinefield

Link to comment
Share on other sites

Hello,

Minefield 3.0 is up

This time, you must fight your way against the time, which is counting down.

It the counter reaches 0 second... KABOOM! :)

You can switch between clock and countdown mode at any time.

In countdown mode, you can enter the time you want to beat.

Edited by vonc

-- VonCMinefield

Link to comment
Share on other sites

Hello,

Minefield 4.0 is up

Cf. first post on this thread

The mode "easy fill" (available since 1.0) enables you click on an explored field and to complete automatcally the adjacent empty fields if possible

(that is:

- if the explored field displays 1 mine, and there is only one adjacent field left unexplored, that adjacent field will be automatically flaged

- if the explored field displays 1 mine, one adjacent field being already flagged, the remaining adjacent unexplored fields will be automatically explored.)

The version 4 comes with a "hints" mode, that is:

it underlines the explored fields on which you can click to get an automatic flag or exploration of remaining adjacent flags.

You can have:

- no easy fill

- easy fill with no hints

- easy fill with hints

Edited by vonc

-- VonCMinefield

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...