Jumping into the world of WPF custom controls, and was wondering what the best way to design a HexGrid control would be? EDIT:Here's a link to Pete's project page which has a hex grid sample.There is a pathfinding sample that shows a project called pathfinding which has a Hex Grid, and probably uses the same basic code that minesweeper does. I haven't looked at it yet. It is Silverlight 3 so may need to be upgraded.
Minesweeper was pretty elegant.RalphORIGINAL:There was a sample for silverlight 2 by peter blois of a hexagonal version of minesweeper.It included source code. He had a very elegant method of doing it by overriding the measureoverride and arrangeoverride on the grid. Mouseovers, etc. There was remarkably little code.I can't find the project on the web any more, although google has a stale link to it by searching for hexagon minesweeper silverlight source code bloisPeter Blois has a current blog at the below address, so you might try contacting him here.Good luck and tell me how it goes, I'm going to be dong something similar.
Hexagonal Minesweeper is a Puzzle and Single-player video game created by T-Yurkiv. It has three different modes and offers similar gameplay to Minesweeper. There are three different modes, and it is available in various sizes to play. Each level consists of a series of cells, and your task is to uncover each one without detonating mines.
The commonly found theme for MinesweeperMinesweeper is a. The objective of the game is to clear a rectangular board containing hidden ' or bombs without detonating any of them, with help from clues about the number of neighboring mines in each field. The game originates from the 1960s, and has been written for many in use today.
It has many variations and offshoots.Some versions of Minesweeper will set up the board by never placing a mine on the first square revealed. Protects the first square revealed; from Windows 7 onward, players may elect to replay a board, in which the game is played by revealing squares of the grid by clicking or otherwise indicating each square. If a square containing a mine is revealed, the player loses the game. If no mine is revealed, a digit is instead displayed in the square, indicating how many adjacent squares contain mines; if no mines are adjacent, the square becomes blank, and all adjacent squares will be recursively revealed. The player uses this information to deduce the contents of other squares, and may either safely reveal each square or mark the square as containing a mine.
Contents.Gameplay Minesweeper has a very basic gameplay style. In its original form, mines are scattered throughout a board. This board is divided into cells, which have three states: uncovered, covered and flagged. A covered cell is blank and clickable, while an uncovered cell is exposed, either containing a number (the mines adjacent to it), or a mine. When a cell is uncovered by a player click, and if it bears a mine, the game ends. A flagged cell is similar to a covered one, in the way that mines are not triggered when a cell is flagged, and it is impossible to lose through the action of flagging a cell. However, flagging a cell implies that a player thinks there is a mine underneath, which causes the game to deduct an available mine from the display.In order to win the game, players must logically deduce where mines exist through the use of the numbers given by uncovered cells.
To win, all non-mine cells must be uncovered and all mine cells must be flagged. At this stage, the timer is stopped.When a player left-clicks on a cell, the game will uncover it. If there are no mines adjacent to that particular cell, the mine will display a blank tile or a '0', and all adjacent cells will automatically be uncovered. Right-clicking on a cell will flag it, causing a flag to appear on it. Note that flagged cells are still covered, and a player can click on it to uncover it, like a normal covered cell.History Minesweeper has its origins in the earliest mainframe games of the 1960s and 1970s.
The earliest ancestor of Minesweeper was Jerimac Ratliff's Cube. The basic gameplay style became a popular segment of the genre during the 1980s, with such titles as (, 1983), Yomp (, 1983), and Cube. Cube was succeeded by Relentless Logic (or RLogic for short), by Conway, Hong, and Smith, available for MS-DOS as early as 1985; the player took the role of a private in the, delivering an important message to the U.S. Command Center.
RLogic had greater similarity to Minesweeper than to Cube in concept, but a number of differences exist:. In RLogic, the player must navigate through the minefield, from the top left right angled corner to the bottom right angled corner (the Command Center). It is not necessary to clear all non-mine squares. Also, there is no mechanism for marking mines or counting the number of mines found. The number of steps taken is counted.
Although no high score functionality is included, players could attempt to beat their personal best score for a given number of mines. Unlike Minesweeper, the size of the minefield is fixed. However, the player may still specify the number of mines.
Because the player must navigate through the minefield, it is sometimes impossible to win — namely, when the mines block all possible paths.The gameplay mechanics of Minesweeper are included in a variety of other software titles, including:. The mini-game Vinesweeper implemented into the; in this iteration (written by developer Danny J), the Minesweeper gameplay is given a large multiplayer aspect and the 'game board' adopts a continually resetting timer. This allows for a never-ending game of Minesweeper where the skill is assessed in points rather than 'game completion'. The PC game Mole Control (developed by Remode); in this game, the Minesweeper mechanic is integrated into a puzzle adventure game based in a village called Molar Creek, which has been overrun with exploding moles. The player acts as the local inventor's assistant, who is tasked with clearing the village of exploding moles. A time attack mode, called the Molar Creek Annual Mole Control competition, is also available.Distribution and variants Versions of Minesweeper are frequently bundled with and, including Minesweeper for, KMines in (-like OSes), in and MineHunt in. Many clones can be found on the Internet.Variants of the basic game generally have differently shaped minefields, in either two or three dimensions, and may have more than one mine per cell.
For example, -based XBomb adds triangular and hexagonal grids, and Professional Minesweeper for Windows includes these and others. There are also variants for more than one player, in which the players compete against each other.The includes a variation on the theme called 'Minehunt', where the player has to move safely from one corner of the playfield to the other. The only clues given are how many mines are in the squares surrounding the player's current position.The Voltorb Flip game in the non-Japanese releases of is a variation of Minesweeper.
A tentaizu puzzle with three stars (mines) already located and four remaining to be found.A variant of minesweeper, suitable for playing on paper, starts with some squares already revealed. The player cannot reveal any more squares, but must instead mark the remaining mines correctly. Unlike the usual form of minesweeper, these puzzles usually have a unique solution. These puzzles appeared under the name 'tentaizu' (天体図), Japanese for a, in Southwest Airlines' magazine Spirit in 2008–2009. In the game, the 2015 April Fool's update 'The Love and Hugs Update' added 'Minescreeper'. It is a near exact copy of Minesweeper, except, instead of avoiding the mines, the player must avoid hidden Creepers. Multiple mines in cellsComputational complexity In 2000, Richard Kaye published a proof that it is to determine whether a given grid of uncovered, correctly flagged, and unknown squares, the labels of the foremost also given, has an arrangement of mines for which it is possible within the rules of the game.
The argument is constructive, a method to quickly convert any into such a grid that is possible the circuit is; membership in NP is established by using the arrangement of mines as a certificate. If, however, a minesweeper board is already guaranteed to be consistent, solving it is not known to be NP-complete, but it has been proven to be.Kaye also proved that infinite Minesweeper is. Rules The first click will never be a mine. It will clear the map and place numbers on the grid. The numbers reflect the number of mines touching a square. See also.Notes. Retrieved 28 March 2017.
Scullion, Chris (3 February 2010). Archived from on 6 February 2010. Retrieved 13 January 2020., accessed 2017-02-07.
Kaye (2000). Allan Scott, Ulrike Stege, Iris van Rooij, Minesweeper may not be NP-complete but is hard nonetheless, The Mathematical Intelligencer 33:4 (2011), pp. 5–17. Kaye, Richard (31 May 2007). Archived from on 3 August 2016. Retrieved 8 July 2016. ^. Retrieved 9 February 2020.References.
(1997). 'How cellular automaton plays Minesweeper'. Applied Mathematics and Computation. 85 (2–3): 127–137. Lakshtanov, Evgeny; Oleg German (2010).
' 'Minesweeper' and spectrum of discrete Laplacians'. Applicable Analysis. 89 (12): 1907–1916.:. Kaye, Richard (2000).
'Minesweeper is NP-complete'. Mathematical Intelligencer. 22 (2): 9–15. — Further information available online at. Mordechai Ben-Ari (2018).
(PDF) (Report). Weizmann Institute of Science, Department of Science Teaching. — An open-access paper explaining Kaye's NP-completeness result.