{"id":25802087,"url":"https://github.com/argirisaitos/blokus-game","last_synced_at":"2026-05-15T13:33:06.523Z","repository":{"id":279289408,"uuid":"938314719","full_name":"ArgirisAitos/Blokus-game","owner":"ArgirisAitos","description":"Command-line Blokus board game implemented in PHP with MySQL database","archived":false,"fork":false,"pushed_at":"2025-02-24T19:26:42.000Z","size":39,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-02-24T20:29:43.272Z","etag":null,"topics":["apache-server","mysql","php"],"latest_commit_sha":null,"homepage":"","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ArgirisAitos.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2025-02-24T18:59:18.000Z","updated_at":"2025-02-24T19:29:23.000Z","dependencies_parsed_at":"2025-02-24T20:31:21.093Z","dependency_job_id":"21f9dce1-6ebc-4d1d-9d27-5231490649f2","html_url":"https://github.com/ArgirisAitos/Blokus-game","commit_stats":null,"previous_names":["argirisaitos/blokus-game"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ArgirisAitos%2FBlokus-game","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ArgirisAitos%2FBlokus-game/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ArgirisAitos%2FBlokus-game/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ArgirisAitos%2FBlokus-game/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ArgirisAitos","download_url":"https://codeload.github.com/ArgirisAitos/Blokus-game/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":241036514,"owners_count":19898166,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["apache-server","mysql","php"],"created_at":"2025-02-27T16:46:38.141Z","updated_at":"2026-05-15T13:33:06.498Z","avatar_url":"https://github.com/ArgirisAitos.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# ADISE24_2020002 Blokus\n\n\n# Blokus Game   API Documentation\n\nThe application is available at:\n**https://users.iee.ihu.gr/~iee2020002/ADISE24_2020002/blokus.php**\n\n## Project Description\n\nBlokus is an online strategy board game where two players place shapes on the board aiming to cover as much space as possible. It was developed as part of the coursework for the Development of Web Systems and Applications course. The API allows game creation, player joining, move management, and game status tracking through CLI tools such as curl.\n\n\n### Technologies\n\n- **Backend:** PHP\n- **Database:** MySQL\n- **Data Format:** JSON\n\n## Database\n\n**Tables:**\n\n- **games:** Stores game information.\n- **moves:** Stores player moves.\n- **players:** Stores player information and their data.\n\n## API Endpoints\n\n### 1. Create New Game\n\n**Endpoint:** `/create`  \n**Method:** POST  \n**Description:** Creates a new game with an empty board (20x20), generates a game_id and a token, stores the game in the database, assigns shapes to the player, and returns the `game_id`, `player_id`,` token`, and a `message`.\n\n**Example:**\n```bash\ncurl -X POST https://users.iee.ihu.gr/~iee2020002/ADISE24_2020002/blokus.php/create/ \\\n-H \"Content-Type: application/json\" \\\n-d '{\"player_id\": \"player1\"}'\n```\n\n**Response:**\n```json\n{\n    \"game_id\": 1,\n    \"player_id\": \"player1\",\n    \"token\": \"c68d9940\",\n    \"message\": \"Game created, First player: start corner (0, 0). Waiting for second player.\"\n}\n```\n\n### 2. Join Game\n\n**Endpoint:** `/join/{game_id}`  \n**Method:** POST  \n**Description:**  Adds a player to an existing game, generates a token for the player, assigns shapes to them, and returns the `player_id`, `token` and a `message`.\n\n**Example:**\n```bash\ncurl -X POST https://users.iee.ihu.gr/~iee2020002/ADISE24_2020002/blokus.php/join/1 \\\n-H \"Content-Type: application/json\" \\\n-d '{\"player_id\": \"player2\"}'\n```\n\n**Response:**\n```json\n{\n    \"player_id\": \"player2\",\n    \"token\": \"c68d9940\",\n    \"message\": \"Game started, Second player: start corner (19, 19). Player 1's turn to play first.\"\n}\n```\n\n### 3. Player Move\n\n**Endpoint:** `/move/{game_id}`  \n**Method:** POST  \n**Description:** The player places a shape on the board following the game's rules.\n\n\n**Example:**\n```bash\ncurl -X POST https://users.iee.ihu.gr/~iee2020002/ADISE24_2020002/blokus.php/move/1 \\\n-H \"Content-Type: application/json\" \\\n-d '{\"player_id\": \"player1\",\"token\":\"c68d9940\",\"piece\": [[1]], \"position\": {\"x\": 0, \"y\": 0}}'\n```\n\n**Response:**\n```json\n{\n    \"success\": \"Move completed successfully.\"\n}\n```\n\n### 4. View Board\n\n**Endpoint:** `/board/{game_id}`  \n**Method:** GET  \n**Description:** Displays the current state of the game board..\n\n**Example:**\n```bash\ncurl -X GET https://users.iee.ihu.gr/~iee2020002/ADISE24_2020002/blokus.php/board/1\n```\n\n**Response:**\n```json\n{\n    \"board\": [\n        [1, 0, 0],\n        [0, 0, 0],\n        [0, 0, 0]\n    ]\n}\n```\n\n### 5. Pass Turn\n\n**Endpoint:** `/pass/{game_id}`  \n**Method:** POST  \n**Description:** The player skips their turn.\n\n**Example:**\n```bash\ncurl -X POST https://users.iee.ihu.gr/~iee2020002/ADISE24_2020002/blokus.php/pass/1 -H \"Content-Type: application/json\"\n-d '{\"player_id\": \"player1\",\"token\":\"c68d9940\"}'\n```\n\n**Response:**\n```json\n{\n    \"success\": true,\n    \"message\": \"You passed your turn and are now excluded from the game.\"\n}\n```\n\n### 6. Game Status\n\n**Endpoint:** `/status/{game_id}`  \n**Method:** GET  \n**Description:** Displays the game status and whose turn it is.\n\n**Example:**\n```bash\ncurl -X GET https://users.iee.ihu.gr/~iee2020002/ADISE24_2020002/blokus.php/status/1\n```\n\n**Response:**\n```json\n{\n    \"message\": \"Game in progress.\",\n    \"player_turn\": \"player2\"\n}\n```\n\n### 7. Available Shapes\n\n**Endpoint:** `/shapes/{game_id}`  \n**Method:** GET  \n**Description:** Returns the available shapes that a player can place.\n\n**Example:**\n```bash\ncurl -X GET https://users.iee.ihu.gr/~iee2020002/ADISE24_2020002/blokus.php/shapes/1 -H \"Content-Type: application/json\" -d \"{\\\"player_id\\\": \\\"player1\\\",\\\"token\\\":\\\"c68d9940\\\"}\"\n```\n\n**Response:**\n```json\n{\n    \"shapes\": [[[1]], [[1, 1]], [[1, 1, 1]], [[1, 0], [1, 1]], [[1, 1, 1, 1]], [[1, 1], [1, 1]], [[0, 1, 0], [1, 1, 1]]]\n}\n```\n\n## Installation Instructions\n\n1. Clone το repository:  \n   ```bash\n   git clone https://github.com/\u003cusername\u003e/ADISE24_2020002.git\n   ```\n2. Create the database: Create the blokus database and import the `schema.sql` file.\n3. Configure database credentials in `db_upass.php`.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fargirisaitos%2Fblokus-game","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fargirisaitos%2Fblokus-game","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fargirisaitos%2Fblokus-game/lists"}