Git Product home page Git Product logo

knightstravails's Introduction

KnightsTravails

Understanding the Code Structure

Maintaining the standard directory structure for golang applications

pkg
config.go

This file contains the strings (messages, error messages etc), the variables needed for our operations (chessBoard, startingPosition, endingPosition) Also defines the valid moves for the knight. (Extensibility aspect) It has the InitConfig method which reads the configs from a yaml file. Making this solution extendable

interface.go

Contains the IChess Interface This interface is implementated to act as a blueprint but more importantly to make testing easy as the project size increases.

knight.go

Contains the core logic of the Knights Travails Problem

types.go

Contians the structs needed for implementing the solution. struct Chess maintains the state of the chess board - rows and columns struct Chess also has a field for input helper which will help us in testing (mocks) struct Coordinates has

utils
interface.go

IInputHelper is an interface that serves as a blueprint for IO related functionalities

types.go

Defines the InputHelper struct which has a field for IO This is done so that if in the future we decide to change the implementation of IO from buffio to something else, we won't have to change the logic in the calling functions

utils.go

Defines all utility functionalities such as getting user input

Instructions for usage

go install github.com/1swaraj/KnightsTravails@latest
KnightsTravails

To change the size of the board

KnightsTravails set-size 8 8

If you get some erros then please cross-verify the goenv

Not recommended but you can also use :-

git clone https://github.com/1swaraj/KnightsTravails
cd KnightsTravails
go mod tidy
go run .

knightstravails's People

Contributors

1swaraj 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.