#We dont want to analize anything but a number #There are currently no (known) blank blocks #Now get a 3x3 grid using the 5x5 grid as the starting point #Symbolize the area we are working on with an X #Make sure the block is one that we are unsure of. #Get a 5x5 grid with x,y as the center point So what i have so far is 2 variables (or rather after some calculations the two variables): I'm currently out of projects and started to play minesweeper I then thought that i could entertain myself by making a program to solve the game. You mayĮxplicitly supply it by calling the SetGrid(int, int) method.So its one of those lazy Thursday evenings and i have all the time in the world to waste away on pointless tasks. Panic when calling the Play() method if the Grid is not supplied. Supplying this Grid is also optional, you may encounter an UnspecifiedGridError One Grid instance and the rest of the arguments will be ignored. Number of trailing arguments of type Grid. The event handler is a bufferedĬhannel that, when used, allows you to setup a particular goroutine toĪs for this method's argument, this method appears to accept an arbitrary Handler allows you to setup event listeners in such situation when a game This method returns the minesweeper interface and the event handler. Game's board size and calling this method will not start the game. Instance without the necessary settings such as the game's difficulty and the Note that this only creates the minesweeper New creates a new minesweeper environment. The last Visit() method call with the last non-mine cell will trigger Treat the called method as if nothing was called at all. Is visited, it will prevent it from being visited and the game would likely originally called the Flag(int, int) method as a result) will have Returned value as your event listener in a separate goroutine. When you originally called the NewGame(.Grid) function and store the second Furthermore, when event handling is supported, a Lose event willĮnqueue to the game's even channel buffer. It will also return an ExplodedError as a second return When encountered, the game ends revealing all mines by the returnedīlock array. The returned Block will return an array of all probed cells with theįirst element as the original visited cell. Probed blank cell recursively until no blank cell is left to be probed. Neighboring cells are safe to be visited and continues to visit any Then there are no neighboring mines per se. Or adjacent cells because if a visited cells contains no warning number, When encountered, a visited cell will recursively visit all neighboring Type of scenario will always return an array of one Block element. The returnedīlock will return an array of revealed cells. We may expect a number when visiting a particular cell. There are three scenarios thatĭepend to the generated configuration of the game: Visit visits a particular cell according to the xy-coordinates of the argument Expand ▾ Collapse ▴įunc Visit(x int, y int) ( Block, error) Please see the CONTRIBUTING.md file for details. GPG VerifiedĬommits are signed by verified PGPs Contributing This project Minesweeper API is released under the GNU General Public License, either version 2 of the License, or (at your option) any later version.
0 Comments
Leave a Reply. |