Giter VIP home page Giter VIP logo

roll1dn's Introduction

roll1dn

Модель

erDiagram
  ROOM {
    u32 room_id
    str name "имя комнаты"
    u8  max_players "максимальное кол-во игроков в комнате"
  }
  PLAYER {
    u32 room_id
    u32 played_id
    str name 
  }
  ROOM }o--o{ PLAYER : room_id
  ROUND {
    u32 round_id
    u32 room_id
    u32 min_players_count "минимальное кол-во игроков для успешного раунда"
    u8 max_winners "максмальное кол-во игроков"
    time_opt started "время начала раунда"
    time_opt finished "время завершения раунда"
    duration timeout "максимальная продолжительность раунда"
  }
  ROOM ||--o{ ROUND : room_id
  ROLL {
    u32 roll_id
    u32 round_id
    u32 player_id
    u8 value
    u32_opt conflict_roll_id    
  }
  PLAYER ||--o{ ROLL : player_id
  ROLL ||--o{ ROUND : round_id
  WINNER {
    u32 round_id
    u32 player
  }
  WINNER }o--|| ROUND : round_id
Loading
  • ROOM Игравая комната
  • PLAYER Игрок
  • ROUND Раунд
  • ROLL Бросок кубика
  • WINNER Победитель

Сценарии

  • Регистрация игрока
  • Регистрация комнаты
  • Старт роунда
  • Бросок кубика

Бросок кубика

stateDiagram-v2
  [*] --> create_round
  create_round --> rolling
  state rolling {
    [*] --> player_roll : incomming http request
    player_roll --> if_round_closed
    if_round_closed --> err_msg : round is closed
    if_round_closed --> add_roll : round is'nt closed
    err_msg --> [*] : output response
    add_roll --> compute_conflict
    compute_conflict --> if_has_conflict
    if_has_conflict --> insert_winner : no conflict
    if_has_conflict --> wait_next : has conflict
    wait_next --> player_roll : output http response
    insert_winner --> close_round
    close_round --> [*] : output http response
  }
Loading

API

  • users
    • POST /user/{name} create user
      • res
        {
          "name": "user name",
          "id": 123
        }
    • GET /user list users
      • res
        [ { "name": "username a", "id":123 } ,
          { "name": "username b", "id":124 } ,
          ....
        ]
    • DELETE /user/{name} delete user
    • POST /user/{name} rename
      • req
        {
          "name": "new name",
          "id": 123
        }
  • room
    • POST /room/{name} create room
      • res
        {
          "name": "room name",
          "id": 123,
          "max_players": 1
        }
    • GET /room list rooms
    • DELETE /room/{name} delete room
    • POST /room/{name}/update
      • req
        {
          "name": "new name",
          "id": 123,
          "max_players": 1
        }
  • room to user
    • PUT /room/welcome/{user_name}/room/{room_name} associate user with room
    • PUT /room/outcome/{user_name}/room/{room_name} de-associate user with room
    • GET /room/{name}/players - players in room
      • res
        [ { "name": "username a", "id":123 } ,
          { "name": "username b", "id":124 } ,
          ....
        ]
  • round
    • POST /room/{name}/start

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.