Git Product home page Git Product logo

knights_travails's Introduction

Knights Travails

Knights Travails is the solution to a programming challenge given to me through the Odin Project, where I had to use a pathfinding algorithm to get the minum amount of moves a knight should take to go from point A to point B.

My algorthim of choice was the A* since it is optimized to find the result where there is only one exit, on the A* I used the manhattan heuristic formula only a bit modified to better suit the movements of a Knight.

Installation

Use the git clone git to install Knights Travails.

git clone https://github.com/ZamboniL/knights_travail.git

You should also have ruby installed in your pc for that check ruby's official installation guide.

Usage

Execute:

ruby lib/knights_travail.rb

With the Knighst_Travail folder open in you terminal.

You will then be asked to insert the coordinates for the starting condition, where the knight will start on the board, and the end position, where the knight should get at the end.

What is the start position?
Give a X (from 1 to 8) position: 
Give a Y (from 1 to 8) position: 
What is the end position?
Give a X (from 1 to 8) position: 
Give a Y (from 1 to 8) position: 

After this the program will calculate the necessary moves and output to the terminal a chess board with each movement the knight made

Repl Terminal

You can also test the code on this repl without installing anything!

What I learned

  • A better understanding of pathfinding algorithms

  • Ruby project organization

  • Even more understanding of OOP

  • How to better plan my projects before starting to code

Contributing

Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.

License

MIT

knights_travails's People

Contributors

zambonil avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.