Git Product home page Git Product logo

shogi's Introduction

Shogi

Shogi repository for a selection process in an international company during the coronavirus quarantine. It is not a version to play, but you can run a lot of tests that show the functionalities implemented. This document includes a brief summary about how to install the code, a list of functionalities implemented, a how to use the application, tests include and, finally, a TODO list for the future.

Prev requirements

The application makes use of third-party libraries. All dependencies are found in the requirements.txt file. It uses pandas library to print quickly the matrix 9*9 that represent the board.

To install the dependencies execute the following command in a virtual python environment:

pip install -r requirements

Classes

The code is divided in classes (inside folder models).

  • File board.py -> It includes the class Board. This is the main class and it includes features like move a piece, check if is mate or reintroduce a captured piece. A board is a 9*9 matrix with 2 arrays to save pieces captures (one per team). Other class in this file is Cell class, that represent a single cell of the board's matrix. This cell contains a piece.
  • File pieces.py -> This file contains a class called Pieces that is the superclass of the rest of shogi pieces. All pieces share common methods and attributes, for example, is_my_movement or is_my_promoted_movement. Also, Pieces contains methods to capture, change color, promoted or undone all them

Functionalities implemented

  • Piece's movement
  • Promoted pieces movement
  • A piece can be promoted during the match
  • Check and check-mate
  • Reintroduced captured pieces

Usage

You can run the application executing the following command

python play.py

And the application shows the initialize board.

Tests

All tests are implemented in the folder called test. This includes:

  • Tests for pieces movement.
  • Tests for pieces promoted.
  • Tests for check (jaque) and check-mate.
  • Tests for reintroduce captured pieces.

You can launch the test suite by running the following command:

python -m unittest

TO-DO list

Technical improvements:

  • Use pytest library for unit testing. Since pytest allows you to manage a fixture file with all data to inject in tests, this allows you to manage better and in a more clear way what you need to test.
  • Mockup some functionalities to speed tests (using monkeypatch for example)
  • Translate code comments to English

Functional improvements:

  • Create a match in which you and a partner can move the pieces to play a real game.
  • User Interface.
  • Initialize the game with famous matchs

shogi's People

Contributors

jjmmolina 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.