michaelbutler / minesweeper Goto Github PK
View Code? Open in Web Editor NEWWebWorker powered Minesweeper game written in JavaScript, HTML and CSS.
Home Page: https://michaelbutler.github.io/minesweeper/
License: GNU General Public License v3.0
WebWorker powered Minesweeper game written in JavaScript, HTML and CSS.
Home Page: https://michaelbutler.github.io/minesweeper/
License: GNU General Public License v3.0
It would be really nice to add a button which pauses the timer so you can answer a call (of nature or phone) in the middle of a game. On the Windows version this happened if you minimised the game but for this version I think a button will do. However it also needs to prevent them "cheating" by using the pause to give themselves time to think, so the board should be hidden while the timer is paused.
Look into gh-pages, I and a lot of people would probably love to try out your game, but it's a little inconvient to have to clone it. May as well just host on gh-pages for free!
Getting really picky now as you can tell Michael so please forgive me - just thinking that we could use jQuery dialog object to present messages to the user rather than the prompt
and alert
methods we use now? Happy to give it a shot if you would rather I did it :)
Suggested improvement: Allow the use of the shift or ctrl key to make a left button on the mouse behave as the right button (as in the Windows version)
The "click both buttons at once" works well enough, but if you were used to the shift or ctrl key feature in the Windows version it does feel slightly easier
Managed to get it working by tweaking the cell_toucher.js and MineSweeper.js.
Hi Michael, since MineSweeper was dropped from Windows I was looking for a close replacement and I came across this one of yours which is probably slightly over-engineered but has introduced me to Workers and other advanced features in JavaScript that I didn't even know were there which makes it by far my favourite implementation. While looking at the code I did find some areas I thought might stand a little improvement, nothing fundamental you understand but just to bring it closer to the original version. I will add each as a separate issue so we can tick them off (as I intend to attempt to make the changes myself in a fork as you suggested in our email exchange), so let's start with this:
The Custom parameters are not validated nor rationalised so you can in fact specify a grid that is too large for Java to handle (e.g. 100 x 100 with 9000 mines) causing the code to "hang" when you click the first square. The original version limited the dimensions to be:
x: between 9 & 30 (I suggest just implementing a maximum of 30, so a minimum of 1)
y: between 9 & 24 (ditto)
mines: the original performs a weird, non-linear calculation to determine a maximum, I suggest a maximum of (number of squares-1) so there is at least one square they can click on
I suggest the Minesweeper code itself performs this rationalisation in the js file to protect the logic, then the same (or more strict) limits can also be applied in the outer code giving a better user experience.
Mines have to be generated after the first click. User cant experience losing the game in the first click.
When you're playing, if you click and before releasing the click drag the mouse to another space in the board you automatically win.
In the later versions of the Windows version they learnt that users got pretty hacked off when the first square they click is a mine and so they coded it so that the top left square was never a mine and so could be relied on as a start point for the puzzle. This is also the reasoning behind my suggestion earlier that the number of mines in a custom grid is always one less than the maximum number of squares, so there is always a non-mine to click on and, of course, it will always be the top-left one.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.