Jump to content




Minesweeper v1.7! (advanced computer/monitor only)

game

20 replies to this topic

#1 GopherAtl

  • Members
  • 888 posts

Posted 18 January 2013 - 12:16 AM

Update: v 1.7 1.6 partially broke monitor support without me realising it, but that is fixed now, as well as some more cosmetic overhauling and a refinement of the way it flood-clears around 0-count tiles.

I decided to work on something quick and easy tonight, to take a break from big projects that require lots of planning and design and etc, so I did something I've meant to do for a while: I threw together Minesweeper!

Requires an advanced computer or monitor; if there's an advanced monitor attached you can run it from a basic computer, tho an advanced computer is recommended for the right-clicking. On a monitor, you switch between showing and flagging a tile by clicking the show/flag button at the top-right.

Two convenience dealies: left-click (or click in "show" mode) a tile that is already revealed and if the number of flags around it equals it's count of mines, all the non-flagged tiles are revealed. (This is like clicking left and right buttons together in windows minecraft). Right-click has the opposite, if the number of unrevealed neighbors equals the count, then they are all flagged. If you care about speed, learn to use these two to your full advantage!
Posted Image
Posted Image

If you play on a single advanced monitor, you will only be able to play easy or medium; the hard board won't fit. It takes an advanced computer or a 2x2 advanced monitor to play hard.

(note to lyqyd: no window_resize event handleing - yet!)

pastebin get nsKrHTbN minesweep

#2 theoriginalbit

    Semi-Professional ComputerCrafter

  • Moderators
  • 7,332 posts
  • LocationAustralia

Posted 18 January 2013 - 12:21 AM

Very nice!

#3 remiX

  • Members
  • 2,076 posts
  • LocationSouth Africa

Posted 18 January 2013 - 04:20 AM

I was planning to make this game sometime but I guess it's too late :[

Very nice btw.

When you lose, could you make it show all the mines?

#4 Left4Cake

  • Members
  • 272 posts
  • LocationEarth

Posted 18 January 2013 - 04:33 AM

Considering the number of door locks on the fourm. I am sure another version of minesweeper wont be that big a deal.

#5 GopherAtl

  • Members
  • 888 posts

Posted 18 January 2013 - 07:11 AM

haha. Yeah, I should really make it show them, and add a game timer and high score table. Some other night I'll sit and work on a version 2.0!

#6 Lyqyd

    Lua Liquidator

  • Moderators
  • 8,451 posts

Posted 18 January 2013 - 07:20 AM

View PostGopherAtl, on 18 January 2013 - 12:16 AM, said:

no window_resize event handleing

:(

View PostGopherAtl, on 18 January 2013 - 12:16 AM, said:

- yet!

:D

Looks excellent, Gopher! Perhaps version 2.0 could also make use of the grey colors instead of black and white for revealed/hidden tiles.

#7 GopherAtl

  • Members
  • 888 posts

Posted 18 January 2013 - 07:28 AM

I was thinking light gray for hidden tiles, leaving revealed black, and doing the empty screen area dark gray, so you can tell what's what more easily.

re: window resize events, it'd be a lot easier to handle if there were a way to set the minimum size it can resize to :P basically going to have to write it to use my gui code, or re-implement scrollable client areas with scroll bars, to make it properly work with resizing windows. Of course, scroll bars would let you do larger maps, and all maps even on a single monitor, so might be worth doing that anyway. I don't like the idea of adding dependencies to this project, tho, I deliberately did it without them. Ah well. 2.0 will probably be a while.

#8 NeverCast

  • Members
  • 400 posts
  • LocationChristchurch, New Zealand

Posted 18 January 2013 - 07:46 AM

Oh No I'm pressed with a situation.. do I continue making my own minesweeper for my os, Or use this one!
DUN DUN DUN!!


Either way, It looks nice Gopher! Excellent work.

#9 NeverCast

  • Members
  • 400 posts
  • LocationChristchurch, New Zealand

Posted 18 January 2013 - 02:00 PM

Why only diagonals here?

if x~=x2 or y~=y2 then
func(x2,y2)
end

Would have thought it would've been a x ~= x2 and y ~= y2

#10 GopherAtl

  • Members
  • 888 posts

Posted 18 January 2013 - 02:05 PM

it's a check to exclude the center, so x ~= centerX or y~=centerY, it could also be written not (x==centerX and y==centerY), but just "x~=x2 and y~=y2" would be the one that only did diagonals :)

#11 NeverCast

  • Members
  • 400 posts
  • LocationChristchurch, New Zealand

Posted 18 January 2013 - 02:56 PM

What? *contemplates getting another Coffee*

Don't you have to confirm that x2 and y2 are both not x and y, else x2 might be x and y not be y2 and it still fail?

#12 GopherAtl

  • Members
  • 888 posts

Posted 18 January 2013 - 03:09 PM

eh? I'm exclusing only the center, where x==x2 and y==y2. Lemme a'splain again...
Spoiler

Also, updated version. Timer, mine count, and a new feature.where right-click on a revealed number to auto-flag neighbors when the number of hidden tiles around it is is equal to the count. Ex, if there's only 2 unrevealed tile left by a "2", right-click the 2 and it is flagged.

#13 GopherAtl

  • Members
  • 888 posts

Posted 18 January 2013 - 08:22 PM

1.7 update, 50% less ugly now, also 10% less crashy (1.6 partially broke monitor support, and introduced another crashy bug as well...<_<)

#14 crazyguymgd

  • Members
  • 139 posts
  • LocationUSA

Posted 18 January 2013 - 08:43 PM

Very cool. Add me to the list of people who have now removed "Make minesweeper" from the list of things to do.

#15 remiX

  • Members
  • 2,076 posts
  • LocationSouth Africa

Posted 19 January 2013 - 01:49 AM

Wow, looks much better:P the whiteness was hurting my eyes...

#16 Tinyboss

  • Members
  • 21 posts

Posted 19 January 2013 - 03:02 AM

View PostGopherAtl, on 18 January 2013 - 07:28 AM, said:

re: window resize events, it'd be a lot easier to handle if there were a way to set the minimum size it can resize to :P basically going to have to write it to use my gui code, or re-implement scrollable client areas with scroll bars, to make it properly work with resizing windows. Of course, scroll bars would let you do larger maps, and all maps even on a single monitor, so might be worth doing that anyway. I don't like the idea of adding dependencies to this project, tho, I deliberately did it without them. Ah well. 2.0 will probably be a while.

Wouldn't it be better to implement the scrollbars in LyqydOS, not in each client separately? Or maybe that's what you meant...

Maybe LOS should offer something like term.setSize(x,y), and add scrollbars to the window as needed.

#17 Lyqyd

    Lua Liquidator

  • Moderators
  • 8,451 posts

Posted 19 January 2013 - 10:48 AM

I like the minimum window size idea. I will add that, and maximums as well.

#18 GopherAtl

  • Members
  • 888 posts

Posted 20 January 2013 - 06:32 AM

the ability for the program to resize/reposition it's own window would be nice too, if it's not already planned.

#19 Lyqyd

    Lua Liquidator

  • Moderators
  • 8,451 posts

Posted 20 January 2013 - 12:07 PM

Indeed, and a fullscreen "mode" will be available as well, eventually.

#20 GopherAtl

  • Members
  • 888 posts

Posted 06 March 2015 - 12:04 PM

bump for long overdue update to ... whichever cc update it was that changed the term functions (1.6?) and removed term.restore(), which was causing this to crash on exit if you used it's built-in ability to run on a monitor.





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users