Inspiration

To life: A dream to live in Canada. To software: Matrix (the movie); Atari Games.

What it does

Is a new concept of old logic game board called mastermind. Referring to current days, you are a hacker and you have to move numbers and try to discover a secret password to save your country from a bomb attack. The game has difficulty levels and each of the levels was created to increase the pressure over the player and this configurations were tested in real player (wife, mother, etc...). The retro design brings the player to a past where the command lines dominated the world of programming.

How we built it

All code (backend and frontend) was developed during Vanhackathon, using Visual Studio and Atom. The frontend was implemented using SPA concept, but without url rotes and with small JQuery libraries to improve loading performance and user experience. A small part of frontend style was created using bootstrap, other styles were created by frontend developer. We had the plan to implement the frontend communication with the API using Ajax calls, but did not have time to finish as implement a responsive layout.

Challenges we run into

Find the right concept to create a short and current game story to an old game; Implement multiplayer game; Solve UI problems;

Accomplishments that we're proud of

After two sleepless nights, everything we develop, the team spirit, be part of this awesome event, this is what makes us proud.

Share this project:

Updates

posted an update

Mastermind VanHackathon API v1.0

Overview

This API works in 2 different modes:

  1. Single Player
  2. Multiplayer

All the rules are implemented, so dont't worry about that.

Single Player Mode

Create a new game is simple, just send a json like below to:

http://<server-name>/api/mastermind/newgame
{
  "user": "Name"
}

You'll receive a response like that:

{
  "colors": [
    "R",
    "B",
    "G",
    "Y",
    "O",
    "P",
    "C",
    "M"
  ],
  "codeLength": 8,
  "gamekey": "E6aFPF0t5EmVGcwnumjcPw==",
  "numGuesses": 0,
  "pastResults": [],
  "solved": false
}
  • colors The colors that you can chose to set the guess code.
  • codeLength The exact length you have to create the guess code.
  • gamekey The game identifier.
  • numGuesses The number that you tried guess the code.
  • pastResults All results of your guesses.
  • solved Game's solved.

The next step is send your guess for:

http://<server-name>/api/mastermind/guess

using:

{
  "code": "GUESSCODE",
  "gamekey": "E6aFPF0t5EmVGcwnumjcPw=="
}

After the play you'll receive the follow responses:

When you don t solved the code:

{
  "codeLength": 8,
  "colors": [
    "R",
    "B",
    "G",
    "Y",
    "O",
    "P",
    "C",
    "M"
  ],
  "gamekey": "E6aFPF0t5EmVGcwnumjcPw==",
  "guess": "OPORCCGB",
  "numGuesses": 1,
  "pastResults": [
    {
      "exact": 0,
      "guess": "OPORCCGB",
      "near": 4
    }
  ],
  "result": {
    "exact": 0,
    "near": 4
  },
  "solved": false
}

When you solve the code:

{
  "codeLength": 8,
  "furtherInstructions": "Solve the challenge to see this!",
  "colors": [
    "R",
    "B",
    "G",
    "Y",
    "O",
    "P",
    "C",
    "M"
  ],
  "gamekey": "y32slt4e5E6nW28f6hLbuw==",
  "guess": "GRGMMGCO",
  "numGuesses": 3,
  "pastResults": [
    {
      "exact": 0,
      "guess": "OPORCCGB",
      "near": 4
    },
    {
      "exact": 0,
      "guess": "OPORCCGB",
      "near": 4
    },
    {
      "exact": 8,
      "guess": "GRGMMGCO",
      "near": 0
    }
  ],
  "result": "You win!",
  "solved": true,
  "timeTaken": 54,
  "user": "felix"
}

Congratulations you win.

Multiplayer Mode

First Player In this mode will be necessary to send some new data to start the game, example below:

http://<server-name>/api/mastermindmultiplayer/join
{
  name:"UserName", 
  role:"CodeBreaker", 
  roomId:""
}
  • role you just can chose for two roles, these are CodeMaker or CokeBreaker

You'll receive a response with the gamekey, room id and message. The message says you need wait for second player.

{
  "gamekey": "2rNym4JyF0uEQKWkYsB/Qw==",
  "roomdId": "e4938012-1478-480d-b53f-e2eea8134164",
  "message": "You are joined. Waiting for the second player!"
}

Second Player Necessary to send the name, role and room id of the room selected. In case you've sent the same role for room that already has a player with the same role, a new room will be created.

http://<server-name>/api/mastermindmultiplayer/join
{
  name:"UserName", 
  role:"CodeMaker", 
  roomId:"e4938012-1478-480d-b53f-e2eea8134164"
}

After sent the post data will receive this response:

{
  "gamekey": "RAbh2lk1okKmfSrbSpcXCA==",
  "roomdId": "4778f056-ec16-429e-9149-5ecab914b93d",
  "message": "You are joined. Waiting for the second player!"
}

Now the second player needs to send the secret code to:

http://<server-name>/api/mastermindmultiplayer/setsecretcode
{
  username:"UserName", 
  roomId: "28e7ea1e-a6d2-4a88-970a-9bba0a5d9aad", 
  code:"MMMMMMMM"
}

The response:

{
  "isReady": true,
  "message": "Secret code is set. Good luck for Code Breker, Enjoy!"
}

So, now you "Code Breaker" are ready to start the guesses sending to...:

http://<server-name>/api/mastermindmultiplayer/tryguesscode

Sending now the gamekey, that you already have kept in older posts.

{
  gamekey:"hwrmzL9GEkeJghErMCW3zA==", 
  code:"YCPORMGB"
}

The response will be:

When you dont solved the code:

{
 "result":{
  "codeLength": 8,
  "colors": [
    "R",
    "B",
    "G",
    "Y",
    "O",
    "P",
    "C",
    "M"
  ],
  "gamekey": "E6aFPF0t5EmVGcwnumjcPw==",
  "guess": "OPORCCGB",
  "numGuesses": 1,
  "pastResults": [
    {
      "exact": 0,
      "guess": "OPORCCGB",
      "near": 4
    }
  ],
  "result": {
    "exact": 0,
    "near": 4
  },
  "solved": false
  }
}

When you solve the code:

{
  "result":{
  "codeLength": 8,
  "furtherInstructions": "Solve the challenge to see this!",
  "colors": [
    "R",
    "B",
    "G",
    "Y",
    "O",
    "P",
    "C",
    "M"
  ],
  "gamekey": "y32slt4e5E6nW28f6hLbuw==",
  "guess": "GRGMMGCO",
  "numGuesses": 3,
  "pastResults": [
    {
      "exact": 0,
      "guess": "OPORCCGB",
      "near": 4
    },
    {
      "exact": 0,
      "guess": "OPORCCGB",
      "near": 4
    },
    {
      "exact": 8,
      "guess": "GRGMMGCO",
      "near": 0
    }
  ],
  "result": "You win!",
  "solved": true,
  "timeTaken": 54,
  "user": "UserName"
  }
}

Mastermind Front End

If you want to see a nostalgic and themed front-end using axiom-zen API, just go to:

http://<server-name>/index.html

ENJOY!!!

That's all folks.

Thanks.

Log in or sign up for Devpost to join the conversation.