This is a read-only snapshot of the ComputerCraft forums, taken in April 2020.
stoneLeaf's profile picture

MineSweeper

Started by stoneLeaf, 08 March 2012 - 09:23 PM
stoneLeaf #1
Posted 08 March 2012 - 10:23 PM
Here's my first lua script.

MineSweeper

A classic minesweeper game.

Some of the features:
  • 3 difficulty levels
  • dynamically fits any terminal size greater or equal to 28x6
  • optimized for SMP (it sends as few as possible text changes to clients)
  • sends redstone signals depending on the game output (feature suggested by Neowulf)
  • - if the game is won, a 2 seconds signal to the back (could be used to trigger a door) - if the game is lost, a 1 second signal to the bottom (could be used to trigger a TNT block) These are the default values, they can be modified by editing the top of the source file.
[attachment=71:minesweeper_v1.0.1.screen1.png][attachment=72:minesweeper_v1.0.1.screen2.png]

Installation

Available on cc-get, simply type:
cc-get install minesweeper

If you want to instal it manually, the source code is available on the script cc-get page (click on the 'minesweeper' file).

Changelog

<1.1>
* scores implemented
* fixed a critical bug introduced in 1.0.3
<1.0.3>
* the first square uncovered will never be a mine
<1.0.2>
* sends redstone signals depending on the game output
<1.0>
* initial release
passinglurker #2
Posted 08 March 2012 - 10:40 PM
hmmm if I fail will it set off a tnt block underneath the terminal?
stoneLeaf #3
Posted 08 March 2012 - 10:58 PM
hmmm if I fail will it set off a tnt block underneath the terminal?
That'd be an interesting feature :mellow:/>/>
nitrogenfingers #4
Posted 08 March 2012 - 11:15 PM
Nice!
Neowulf #5
Posted 08 March 2012 - 11:21 PM
Player wins, send a pulse out the back of the computer (to open a door or something).
Player loses, send a pulse out the bottom of the computer (to trigger the TNT pile beneeth their feet).
passinglurker #6
Posted 08 March 2012 - 11:32 PM
or add terminal controlled turtles for a more user friendly game of "real" minesweeper the turtles could even be used to repair and randomize the playing field
stoneLeaf #7
Posted 09 March 2012 - 12:00 AM
Player wins, send a pulse out the back of the computer (to open a door or something).
Player loses, send a pulse out the bottom of the computer (to trigger the TNT pile beneeth their feet).
Thanks for the tip, it's now implemented!

or add terminal controlled turtles for a more user friendly game of "real" minesweeper the turtles could even be used to repair and randomize the playing field
I thought about that, I'll see if I find time to code it.
Wolvan #8
Posted 10 March 2012 - 09:07 AM
or add terminal controlled turtles for a more user friendly game of "real" minesweeper the turtles could even be used to repair and randomize the playing field
I thought about that, I'll see if I find time to code it.
I could help with this :mellow:/>/>
stoneLeaf #9
Posted 10 March 2012 - 05:21 PM
or add terminal controlled turtles for a more user friendly game of "real" minesweeper the turtles could even be used to repair and randomize the playing field
I thought about that, I'll see if I find time to code it.
I could help with this :mellow:/>/>
You're free to use my code as long as you license your work under the GPL.

I was thinking the turtle(s) could start by laying out a surface layer, which would hide the TNT placed afterwards underneath. Then the computer would be used to control the uncovering process of the field. It would be some kind of "real life" enactment of the game action.
Wolvan #10
Posted 10 March 2012 - 05:46 PM
or add terminal controlled turtles for a more user friendly game of "real" minesweeper the turtles could even be used to repair and randomize the playing field
I thought about that, I'll see if I find time to code it.
I could help with this :mellow:/>/>
You're free to use my code as long as you license your work under the GPL.

I was thinking the turtle(s) could start by laying out a surface layer, which would hide the TNT placed afterwards underneath. Then the computer would be used to control the uncovering process of the field. It would be some kind of "real life" enactment of the game action.
I could help with the controlling that is
stoneLeaf #11
Posted 17 March 2012 - 09:38 PM
Updated.
1.0.3: the first square uncovered will never be a mine
stoneLeaf #12
Posted 23 March 2012 - 10:03 AM
Updated.

[1.1]
* scores implemented
* fixed a critical bug introduced in 1.0.3
Ian-Moone #13
Posted 23 March 2012 - 10:09 AM
a few edits here and there and it could be a survival game if you die you die in minecraft not just on the game help im confusing myself
stoneLeaf #14
Posted 23 March 2012 - 10:20 AM
a few edits here and there and it could be a survival game if you die you die in minecraft not just on the game help im confusing myself
Already possible, in a way, since you can place a TNT block underneath which will be powered when a game is lost :(/>/>