MineSwee++ 2
  AlgorithmAlgorithm of C[o]re

MineSwee++ 2 is close-source. However, I decide to make the algorithm of C[o]re public. If you have any idea on improving it, feel free to contribute.

The following pseudo-code is used since MineSwee++ 2 Release Candidate V (2.1.503).

GetGridWithBestProbability(board) returns (row, col)
board: the board being played
row: the row index of the grid to open
col: the column index of the grid to open
begin
   initialize board_sum with all 0
   initialize board_no_mines_around_sum with all 0
   num_mines ← number of mines flagged in board
   num_mines_left ← 51 - num_mines
   num_matched_board ← 0
   while num_matched_board is not large enough and time is not up do
   begin
      board2 ← generate a board with num_mines_left 1's randomly spread in suited places 
                                     and (256 - num_mines_left) 0's in other places
      if ((1's of board2) and (mines of board)) matches conditions of board then
      begin
         add board2 to board_sum
         for each corresponding grid in board, grid2 in board2,
                                gridnma in board_no_mines_around do
         begin
             if total number of mines around (grid and grid2) = 0 then
             begin
                gridnma ← 1
             end
             else
             begin
                gridnma ← 0
             end
         end
         add board_no_mines_around to board_no_mines_around_sum
         num_matched_boardnum_matched_board + 1
      end
   end
   if num_matched_board = 0 then
   begin
      return (0, 0)
   end
   best_grid_row ← 0
   best_grid_col ← 0
   best_grid_probability ← 0
   best_grid_probability_no_mines_around ← 0
   for r ← 1 to 16 do
   begin
      for c ← 1 to 16 do
      begin
         if board_sum[r][c] ≥ best_grid_probability then
         begin
            if board_sum[r][c] - best_grid_probability > num_matched_board × 0.03
               or (board_no_mines_around_sum[r][c] ≤ best_grid_probability_no_mines_around
                   and neither r nor c is margin) then
            begin
               best_grid_rowr
               best_grid_colc
               best_grid_probabilityboard_sum[r][c]
               best_grid_probability_no_mines_aroundboard_no_mines_around_sum[r][c]
            end
         end
      end
   end
   return (best_grid_row, best_grid_col)
end
Sections
  Introduction Introduction
- Introduction to MineSwee++ 2

Development Story Development Story
- Development story of MineSwee++ 2

Download Download
- Download MineSwee++ 2

FAQ FAQ
- Frequently Asked Questions of MineSwee++ 2

Changelogs Changelogs
- MineSwee++ 2 changelogs

Algorithm Algorithm
- Algorithm of C[o]re

Contribute Contribute
- Contribute to MineSwee++ 2
Links
  Official Thread MineSwee++ 2 Official Thread
- The official discussion thread of MineSwee++ 2 on MsgPlus! Live forums



Valid XHTML 1.0! Valid CSS! Valid RSS!  

Powered by Ubuntu Powered by Apache Powered by PHP 5 Powered by MySQL 5 RSS 2.0 Syndication

Icons used on this website come from Microsoft Windows and other Microsoft products.
All trademarks mentioned on this page are the property of their respective owners.
All date/time reference on this page, if not specified, is of the timezone of Taipei (GMT +0800).
# Middle Sea Copyright © 2003-2008 # Middle Sea, Mnjul's Intimate Home by Mnjul / purincess (Min-Zhong Lu)