Pages: 1
My new version of minesweeper uses a list to keep track of mine locations.
http://scratch.mit.edu/projects/Mayhem/295207
Its a 10x10 play area, and to see what number needs to be displayed the scripts add up the 8 squares surrounding the one you click on.
In order for there be something to add up if you click on the edge, the list is 144 items long, creating a "virtual" 12x12 square - the 10x10 play area plus a strip of empty squares along each side of that play area.
To set up the grid:
First, 20 "1"s are added to the list, representing mines. Then, 80 "0"s are put in randomly, creating the safe squares.
To turn this from a 10x10 grid into the required 12x12 virtual grid, extra empty squares are added - these could be "0"s but for debugging purposes I have made them "X"s:
The script inserts 12 at the start of the list, creating the bottom row of the virtual grid.
Then, in order it inserts an "X" at:
13 and 24 (the left and right edge of the 2nd row, respectively)
25 and 36
37 and 48 etc etc
Then, to put the top row on, it inserts 12 "x"s at the end of the list.
It words perfectly online, and debugging tests show that the "X"s are being put into the right place in the list.
However,on the website, when the contents of the list are translated into the contents of the grid, all the squares are all misplaced one row to the right, and I can't work out why.
Help!
(To see what I mean, download then compare the website version, where it will (on failure) print a double row of "X"s on the left of the grid with a game run offline)
Offline
Thesame is also true in my Chess project - works fine offline, but something interferes with the creation or reading of lists on the web.
Or it may be something to do with the definition of x/y reading points, but I would not have thought so
http://scratch.mit.edu/projects/Mayhem/298314
Offline
Could the problem be related to this error? http://scratch.mit.edu/forums/viewtopic.php?id=9661
Offline
Could be! I'll try fixing the chess game... fixing minesweeper might be harder :S
Offline
http://scratch.mit.edu/forhttp://scratch.mit.edu/forums/viewtopic.php?id=10831#req_messageums/http://scratch.mit.edu/forums/viewtopic.php?id=10831#rhttp://scratch.mit.edu/forums/viewtopic.php?id=10831#req_messageeq_messaghttp://scratch.mit.edu/forums/viewtopic.php?id=10831#req_messageeviewtopic.phhttp://scratch.mit.edu/forums/viewtopic.php?id=10831#req_messagep?id=10831#req_message
Offline
Pages: 1