Code Monkey home page Code Monkey logo

hangman-game's Introduction

hangman-game

Hangman game. It's just example of my code.

About Hangman game

Structure:

  • /config - some environment variables, for example: redis config
  • /public - entry-points
  • /src/Controller - controllers, individual folder for each endpoint
  • /src/Controller/*/Input - Request (DTO) and RequestConverter (Request Factory with validation)
  • /src/Controller/*/Output - Response (DTO), individual for each endpoint just for flexibility
  • /src/Model/Hangman - Hangman game model
  • /src/Service - common services
  • /src/Service/GameManager - main business-logic of game
  • /tests/Controller - smoke-tests for controllers
  • /tests/Service - tests for business-logic

Dev-environment

Installation

  1. docker-compose up -d
  2. docker-compose exec php-fpm composer install
  3. docker-compose exec php-fpm cp /application/config/config.dist.php /application/config/config.php

Tests

docker-compose exec php-fpm composer test

Available Endpoints

Create Game

POST http://localhost:4201/create_game.php

"word":"test" // word for game
"missesMax":6 // misses amount

Response

{
    "gameKey": "5d846a1999cd4"
}

Get Game

GET http://localhost:4201/get_game.php?gameKey=5d846a1999cd4

Response

{
    "row": "____", // each '_' means letter to guess
    "misses": [], // your misses array
    "result": null // can be null, 'win' or 'lose'
}

Check guess

POST http://localhost:4201/check_guess.php

"gameKey": "5d846a1999cd4"
"guess": "o" // your guess, just a letter or whole word

Response

{
    "row": "____", // each '_' means letter to guess
    "misses": ['o'], // your misses array
    "result": null // can be null, 'win' or 'lose'
}

hangman-game's People

Contributors

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