Skip to content
/ lgc Public

Letsgetchecked Turtle Challenge

Notifications You must be signed in to change notification settings

Coelho04/lgc

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Turtle Challenge

A turtle must walk through a minefield.

The goal is to given a set of one or more sequences of moves the turtle should reach the exit.

You can see more information about it here

Project overview

This is a .NET Console Application that takes two file names as input arguments.

The game settings file and the sequence of moves file.

The application will execute sequence of moves and preform the moves operations on the turtle. At the end of each sequence the result will be printed to the console.

The choosen format of the files was JSON mainly because of its readability and ease of use.

The Game Settings

{
  "size": {
    "width": 5,
    "height": 4
  },
  "startingPosition": {
    "x": 0,
    "y": 1
  },
  "startingDirection": "North",
  "exitPosition": {
    "x": 4,
    "y": 2
  },
  "mines": [
    {
      "x": 1,
      "y": 1
    },
    {
      "x": 3,
      "y": 1
    },
    {
      "x": 3,
      "y": 3
    }
  ]
}

We perform some validations on the Game Settings Json, for instance:

  • We Validate that the Height and Width of the board cannot be lower or equal to 0
  • We validate that the turtle initial position is not the as a mine or exit
  • We validate that the turtle initial position is not outside of the board

The Sequences of Moves

{
  "Sequences": [
    ["m","r","m","m","m","m","r","m","m"],
    ["r","m"],
    ["m","m","m"],
    ["r","r","r"],
    ["q","r","m","e","r","q"],
    ["m","r","m","m","m","m","r","m"]
  ]
}

Running the application

To run the application you just need to go the src/Challenge folder and execute the command

dotnet run -- GameSettings SequenceSettings

And you should be able to see something like this

Result

About

Letsgetchecked Turtle Challenge

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages