Giter Site home page Giter Site logo

tictactoe's Introduction

Tic Tac Toe Game

Webservice that exposes two APIs to play to Tic Tac Toe Game.

How To

Install

Run

Run tic tac toe webservice:

docker compose up -d

Check all running containers:

docker compose ps

You should see db and php services running.

Use

Exposed API:

  • Create a new game session (start game):
    • Request POST /public/api/game-sessions
    • Response returns a new game session (id, players, board, etc...)
  • Update the specific game session (make a move):
    • Request PUT /public/api/game-sessions/{id}
    • Response returns the game session updated (updated board, player won, etc...)

Call exposed APIs with an http client (cUrl, Postman, Frontend app, etc...) like this:

curl -X POST http://localhost:8073/public/api/game-sessions
curl -X PUT -d '{"player_id":"<Player ID>","row":<Row>,"column":<Column>}' http://localhost:8073/public/api/game-sessions/<GameSession ID>

where: - Player ID is the ID of the player that makes the move (players IDS are returned from create game session API) - Column is the column number (from 1 to 3) - Row is the row number (from 1 to 3) - GameSession ID is the ID of the current GameSession (game session ID is returned from create game session API)

Development tools

Psalm

Run static code analysis:

docker compose run php psalm

PHP_CodeSniffer

Detect coding standard violations:

docker compose run php cs

Fix coding standard violations:

docker compose run php cbf

Tests

Run automatic tests:

docker compose up -d db_test
docker compose run php test

tictactoe's People

Contributors

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