Code Monkey home page Code Monkey logo

shogi's Introduction

Table of Contents

Environment setup

Needed tools

  1. Install Docker
  2. Clone this project: git clone https://github.com/marydn/shogi
  3. Move to the project folder: cd shogi
  4. Install PHP dependencies and bring up the project Docker containers with Docker Compose: make build
  5. Check everything's up using: $ docker-compose ps. It should show php service up.

Note: If you want to bring down Docker service use: make destroy

Application execution

Start game using: make play

End the game at any time by writing quit instead of entering a new move.

Tests execution

Execute PHP Unit tests: make test

Project explanation

OOP Design example for a variation of a Japanese chess version called Shogi.

Developed features:

  • Console interactive interface
  • Pieces placement
  • Pieces movements
  • Capture opponent's pieces
  • Drop captured pieces (only Pawns)
  • Pieces are automatically promoted when they reach promotion zone (last 3 rows)

Diving project structure:

$ tree -L 4 src
src
├── Board.php
├── CliPrintableSpot.php # Decorator for console output
├── Command
│   └── GameCommand.php # Console output application
├── CoordinateTranslator.php # Translate user's input to a valid coordinate to handle internally
├── Exception
│   ├── CoordinateNotFound.php
│   ├── CoordinateNotWellFormedNotation.php
│   ├── IllegalMove.php
│   └── PieceNotFoundInInventory.php
├── Game.php
├── Move.php
├── MovesList.php # Collection of Moves
├── Notation.php # Every move is saved as a Notation object
├── Pieces # Every piece in the Board
│   ├── BasePiece.php
│   ├── Bishop.php
│   ├── GoldGeneral.php
│   ├── King.php
│   ├── Knight.php
│   ├── Lance.php
│   ├── Pawn.php
│   ├── PieceDroppableInterface.php # This Interface is for pieces that can be droppable
│   ├── PieceInterface.php
│   ├── PiecePromotableInterface.php # This Interface is for pieces that can be promoted
│   ├── Rook.php
│   └── SilverGeneral.php
├── PlayerInventory.php # Player's inventory
├── Player.php # Every player of the game
├── Shared
│   ├── Collection.php # Abstract class for Objects that holds collections
│   └── Enum.php # Abstract class for Objects used as an Enum value object
├── Spot.php # Every spot in the Board
└── ValueObject
    ├── Coordinate.php # User's input
    └── NotationType.php # ValueObject to identify the type of move

UI Preview:

image info

shogi's People

Contributors

lyrixx avatar marydn avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Forkers

lyrixx

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.