11-30-2023, 12:41 PM
(This post was last modified: 11-30-2023, 01:58 PM by 1micha.elok.)
(11-25-2023, 08:14 AM)Marcus Wrote: I found the source code of a minsweeper game on a backup drive. I think it's for n5, but it might be even older than that. It's a short program, so translating it line by line to n7 only took me a couple of minutes. As with the Robowack translation, this code doesn't take advantage of the new stuff in n7. The original n5 source code is included.
The minesweeper game is an old memory for me. At that time, I was still a highschool student playing the minesweeper in Windows 3.1 ( ? ). After 35 years, finally I have known how to code the minesweeper
![Big Grin Big Grin](https://www.naalaa.com/forum/images/smilies/biggrin.png)
![Big Grin Big Grin](https://www.naalaa.com/forum/images/smilies/biggrin.png)
![Big Grin Big Grin](https://www.naalaa.com/forum/images/smilies/biggrin.png)
![Cool Cool](https://www.naalaa.com/forum/images/smilies/cool.png)
![Tongue Tongue](https://www.naalaa.com/forum/images/smilies/tongue.png)
![Tongue Tongue](https://www.naalaa.com/forum/images/smilies/tongue.png)
![Tongue Tongue](https://www.naalaa.com/forum/images/smilies/tongue.png)
Code:
' ================
' MAIN PROGRAM
' ================
do
' Transform from mouse to field coordinates.
xm = int(mousex()/16)
ym = int(mousey()/16)
' Left Button Mouse
if mousebutton(0, true)
if HasBomb(xm, ym)
PutFlag(xm,ym) 'You always win
else
Sweep(xm, ym)
endif
RedrawGrid()
endif
'ESC to quit
if keydown(KEY_ESCAPE) then end
wait 1
redraw
loop