Other free points show as an integer count of the number of adjacent true mines in its immediate neighborhood, or as a single space ' ' if the free point is not adjacent to any true mines.If the point is free space then it is cleared, as are any adjacent points that are also free space- this is repeated recursively for subsequent adjacent free points unless that point is marked as a mine or is a mine.You can mark what you think is free space by entering its coordinates.You may mark what you think is the position of a mine which will show as a '?'.You are initially shown all grids as obscured, by a single dot '.'.The grid is shown as a rectangle of characters between moves.Each mine occupies a single grid point, and its position is initially unknown to the player.The total number of mines to be found is shown at the beginning of the game.The top left of the grid is position 1,1 the bottom right is at n,m. Positions in the grid are modified by entering their coordinates where the first coordinate is horizontal in the grid and the second vertical. There is an n by m grid that has a random number (between 10% to 20% of the total number of tiles, though older implementations may use 20%.60% instead) of randomly placed mines that need to be found. This way it eliminates the need for hard coding edges and corners because it would exceed matrix dimensions.You are encouraged to solve this task according to the task description, using any language you may know. I was thinking of surrounding the matrix with zeroes and then programming it in a way where it adds up all the surrounding ones. The output would be ġ,2,4 etc means that there are 1, 2 or 4 mines around that square.ĭo i have to hard code every possibility or do I use if or while loops? Or does anybody have a different approach to this? The output is another matrix telling where the mines are and the proximity of each mine.įor example: if i had the input matrix The input is a matrix filled with zeroes and 1's, ones being the mines and zeroes being nothing. I am learning basic matlab and one of the assignment is to create a minesweeper function.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |