This is Minesweeper with Golang Backend

Build Status

Master Develop
Build Status Build Status

Starting the Application

The application is provided as an docker image.

Master

    docker run terraform.cs.hm.edu:5043/ob-algdatii-ss19-leistungsnachweis-minesweeper:master

Develop

    docker run terraform.cs.hm.edu:5043/ob-algdatii-ss19-leistungsnachweis-minesweeper:develop

Project Structure

The project is divided into two parts, the Angular frontend and the golang backend. By design it is not possible to get any information about the location of the bombs without uncovering the accoring field. A very simple hint tool is provided which allows getting hints for possible safe or unsafe fields on the playground.

The size of the playground is variable, also the amount of bombs, so you can configure it by your self how difficult it should be.

Backend

The Backend hosts a GraphQL API for interacting with the frontend. It provides two query options and two mutations which are explained in the following section. Additional it is able to host a precompiled frontend using static file serving. This files are expected in folder ./web relatively to the working directory.

Queries

State of playground:


    query{
        get{
            win,
            rows{
                fields{
                    uncovered,
                    closebombs,
                    bomb,
                    flagged
                }
            }
        }
    }
            

Hint:


    query{
        hint{
            x,
            y,
            action
        }
    }
            

Mutations

Create playground:


    mutation{
        init(x: width, y: height, bombs: amount-of-bombs){        
            rows{
                fields{
                    uncovered,
                    closebombs,
                    bomb,
                    flagged
                }
            }
        }
    }
            

Pass click on field to backend (either uncover or flagging)


    mutation{
        click(x: x-pos, y: y-pos, flag: boolean){
            win,
            rows{
                fields{
                    uncovered,
                    closebombs,
                    bomb,
                    flagged
                }
            }
        }
    }
            

Frontend

The frontend is created using the Angular Toolkit. It interacts with backend using the explained GraphQL actions.

Generated API Documentation

Click here …