Challenge – Minesweeper Solver

Do you like solving puzzles as much as myself and my Demcon colleagues?
Then I got a challenge for you: can you solve the Minesweeper challenge?

If you succeed, you have a chance to win a raspberry pi pico kit!
Read the full challenge below.
It should not take you longer than one hour to solve.
Send in your answer before 1 August 2022.

I wish you good luck!
Pieter Bijleveld
#decodedemcon

< ALL CHALLENGES

Pieter Bijleveld

Senior Software Engineer at Demcon

THE CHALLENGE *

You are tasked with creating a Minesweeper Solver. Your Solver is presented with a MineField Object, the interface of which is defined below. The Solver will start the process with a random guess. After the first guess, the MineField object will fill in the field automatically, and return the number of mines that are adjacent to that cell. Your software will keep sweeping (In whatever way you decide is best) until it is either solved or it failed. To help you along, we have provided a MineField class for you, which you can find here. It generates a random MineField of a defined number of rows, columns, and number of mines. You can play Minesweeper with it by calling its member functions. You can also construct a MineField object with predefined configurations called BEGINNER_FIELD, INTERMEDIATE_FIELD and EXPERT_FIELD.

MINESWEEPER CLASS INTERFACE DEFINITION

Functions

  • def __init__(self, width: int, height: int, number_of_mines:int)
    The constructor.
  • def sweep_cell(self, column: int, row: int)
    Returns the number of adjacent mines. Throws a ExplosionException if the guess was a bomb.
SPECIFICS & RULES
  • Please write your solution in Python.
  • Please add information (in the README) on how to execute the code.
  • Your solution should be able to output the location of all the bombs. If it fails, it should output the location of the bombs that it found.
  • We will evaluate your solutions based on inventiveness, efficiency, and good coding practices.
  • We will only accept submissions in the form of a link to a Github repository.
  • Please submit to communication@demcon.com
  • We’ve added some instructions below if you’re unfamiliar with Github.
HOW TO USE GITHUB
  • In your internet browser, navigate to github.com
  • Enter your email address, and press ‘sign up for GitHub’
  • Press continue, create a password and enter a username
  • Solve the puzzle to show that you are a human
  • Verify your email address and customize your Github experience
  • Create a new project by pressing ‘start a project’
  • Give your repository a name, and make sure it is set to public. Press ‘create repository’
  • In quick startup, press ‘create new file’ or ‘upload existing file’
  • Enter the code for this challenge here
  • When you are ready to submit, go to the <>code section of your repository and press ‘code’ and copy the HTTPS link. Enter this link into your submission.

* Challenge created by Pieter Bijleveld and Jeroen Verberne.