Git Product home page Git Product logo

tui-checkers's Introduction

tui-checkers

A somewhat mediocre, but fully functional, checkers engine with a sloppy TUI on top of it.

Usage

Run the checkers binary to run the game. To make a move, input the move you would like to make as (startX, startY), (endX, endY), where the bottom left corner is (0, 0) and the top left corner is (7, 7). Red goes first, and white goes second. Also, don't input it with the wrong format or the game will crash :)

Building for Linux

  • Clone into this repository git clone https://github.com/theultraman20/tui-checkers
  • Run make make

Issues

  • The biggest issue with this program is that it uses an array of pointers (to pieces) to represent the board. I thought I would give it a try in hopes of making my code lighter, faster, and more readable, but unfortunately I ended up with the opposite. This had the consequence of making each function that has to manipulate the board itself require the pieces position as an argument, as you need to klnow the position of the piece in order to remove or move it on the board. This makes the code much more tedious and confusing then it should be.

  • The code for checking if a move is valid keeps track of the jumps needed to create that move and stores it on a jump stack inside the checkerboard object, for the piece moving function to use to remove jumped pieces. This means that a part of the code that is supposed to check if a move is possible actually modifys the object itself, and performs more then it's intended function.

Todo

  • Handle a misformatted game move input properly
  • Input moves using the arrow keys to select and move a piece instead of asking for coordinate input
  • A better TUI, and options for ASCII or Unicode output
  • Multiplayer (won't happen lol)

tui-checkers's People

Contributors

icanquitwheneveriwant avatar

Stargazers

 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.