+ 2

Ideas for improving JavaScript game (Minesweeper)

I made Minesweeper as my first JavaScript project: https://code.sololearn.com/Wo6A070fm13c/?ref=app I don't know much about JavaScript so I thought I'd ask you for ideas on how to improve it. I think it's annoying having to change the mode for flagging or uncovering (only on the phone, you can use right-click on desktop computers), in some browsers you can press and hold, but it doesn't work in SoloLearn. Is there a touch-event or something that I could use for pressing and holding also in SoloLearn?

1st Jul 2017, 9:58 AM
JtheDroid
JtheDroid - avatar
11 ответов
+ 16
Fix this: SyntaxError: unexpected end of input Line: 6.
1st Jul 2017, 10:15 AM
Igor Makarsky
Igor Makarsky - avatar
+ 13
Unexpected token = Line 451
1st Jul 2017, 3:08 PM
Valen.H. ~
Valen.H. ~ - avatar
+ 13
It's nice... Improve CSS centering a bit.... ^_^
1st Jul 2017, 4:02 PM
Valen.H. ~
Valen.H. ~ - avatar
+ 13
Here.... Try this : body{ background: #505055; color: #fff; font-family: sans-serif; font-size: 1em; text-align: center; margin:0; overflow:hidden; } .settings { background:#404045; } body * { border-radius:5%; } ^_^
1st Jul 2017, 4:09 PM
Valen.H. ~
Valen.H. ~ - avatar
+ 12
Uncaught SyntaxError Unexpected token = Line 129 ^_^
1st Jul 2017, 10:27 AM
Valen.H. ~
Valen.H. ~ - avatar
+ 2
Thanks for all your help! It looks nice! I modified it a little bit, for example the overflow thing causes the canvas to disappear on small screens I'm also currently changing the button to switch the action, it's still WIP, but I already saved it
1st Jul 2017, 4:50 PM
JtheDroid
JtheDroid - avatar
+ 1
Strange, it works fine for me. In line 6, I'm only declaring variables, in line 129 I also had an error before but I saved it after fixing it...
1st Jul 2017, 10:34 AM
JtheDroid
JtheDroid - avatar
+ 1
@ValentinHacker Ah I think I found what could have caused the error, should now work
1st Jul 2017, 10:43 AM
JtheDroid
JtheDroid - avatar
+ 1
One issue is that both green of the number 2 and the background of game when someone win are the same color tone. The second is that you can put 0 to X and Y, a number higher than 2 should be the minimum. One tip that I can give you is to put a function to open all squares around when you click in a number and you put all the flags that you needed like the Minesweeper that comes in Windows 7. Another tip is to put another function to not allow the user to put more bombs than tiles in the game, another to automatically decrease the number if the tiles is decreased when the player is adjusting the game and if he increases it the bombs increase proportionally.
20th Dec 2017, 10:12 PM
Henry
Henry - avatar
0
@ValentinHacker I guess I fixed line 451 but I'm still confused where you're seeing these errors
1st Jul 2017, 3:58 PM
JtheDroid
JtheDroid - avatar
0
@ValentinHacker Thanks :) I will try, but I basically know nothing about CSS, only what I used in the code, so I'm gonna start the CSS course now ;)
1st Jul 2017, 4:07 PM
JtheDroid
JtheDroid - avatar