Skip to content

Game web api #5

@acautin

Description

@acautin

To start we should implement:

  • create_challenge (board_parameters, category, time_limit) -> game_id.
  • accept_challenge (game_id) -> already_accepted | game_state.
  • cancel_challenge(game_id) -> ok | invalid_game_id.
  • play (game_id, player, position) -> invalid | accepted | you_won | tie | you_lost | game_state.

Anyone (initially also non registered users) can create a challenge (game), gets a unique game_id and must wait until another player accepts this challenge.

game_state :: {board_parameters, last_player, last_move, next_player, board}

board_parameters ::
{ width :: integer() % board width >= 3
, height :: integer() % board height >= 3
, run :: integer() % sucess run length
, gravity :: boolean() % do moves fall towards higher row numbers
, periodic :: boolean() % unbounded repeating board
}

board: string [width * height] of characters indicating state of a cell.
possible cell states (in ascii): O | X | * | $
the opener of the challenge uses 79 (ascii O)
the player accepting the challenge uses 88 (ascii X)
the * character represents a joker
the $ character represents a block

player :: integer() % player alias in this game (same type for last_player, next_plaxer)

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions