Update readme
This commit is contained in:
393
README.md
393
README.md
@ -8,10 +8,10 @@
|
||||
- Destination: center of a board (W / 2, H / 2)
|
||||
- Initial player position: Random on board border
|
||||
- Available moves:
|
||||
- left
|
||||
- right
|
||||
- up
|
||||
- down
|
||||
- left
|
||||
- right
|
||||
- up
|
||||
- down
|
||||
- Optional on-board obstacles
|
||||
|
||||
### Rules
|
||||
@ -202,33 +202,33 @@ Check REST API interface on [FastAPI docs](http://localhost:8010/docs).
|
||||
Request body:
|
||||
```json
|
||||
{
|
||||
"player_name": "Pero"
|
||||
"player_name": "Pero"
|
||||
}
|
||||
```
|
||||
|
||||
Response body:
|
||||
```json
|
||||
{
|
||||
"board": {
|
||||
"width": 101,
|
||||
"height": 101
|
||||
},
|
||||
"destination": {
|
||||
"position": {
|
||||
"x": 50,
|
||||
"y": 50
|
||||
}
|
||||
},
|
||||
"player": {
|
||||
"id": "75bba7cd-a4c1-4b50-b0b5-6382c2822a25",
|
||||
"name": "Pero",
|
||||
"position": {
|
||||
"x": 0,
|
||||
"y": 10
|
||||
},
|
||||
"move_count": 0,
|
||||
"move_attempt_count": 0
|
||||
}
|
||||
"board": {
|
||||
"width": 101,
|
||||
"height": 101
|
||||
},
|
||||
"destination": {
|
||||
"position": {
|
||||
"x": 50,
|
||||
"y": 50
|
||||
}
|
||||
},
|
||||
"player": {
|
||||
"id": "75bba7cd-a4c1-4b50-b0b5-6382c2822a25",
|
||||
"name": "Pero",
|
||||
"position": {
|
||||
"x": 0,
|
||||
"y": 10
|
||||
},
|
||||
"move_count": 0,
|
||||
"move_attempt_count": 0
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
@ -251,16 +251,16 @@ Response code:
|
||||
Response body:
|
||||
```json
|
||||
{
|
||||
"player": {
|
||||
"id": "string",
|
||||
"name": "Pero",
|
||||
"position": {
|
||||
"x": 50,
|
||||
"y": 50
|
||||
},
|
||||
"move_count": 10,
|
||||
"move_attempt_count": 12
|
||||
}
|
||||
"player": {
|
||||
"id": "string",
|
||||
"name": "Pero",
|
||||
"position": {
|
||||
"x": 50,
|
||||
"y": 50
|
||||
},
|
||||
"move_count": 10,
|
||||
"move_attempt_count": 12
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
@ -273,16 +273,16 @@ Request body: None
|
||||
Response body:
|
||||
```json
|
||||
{
|
||||
"player": {
|
||||
"id": "string",
|
||||
"name": "Pero",
|
||||
"position": {
|
||||
"x": 50,
|
||||
"y": 50
|
||||
},
|
||||
"move_count": 10,
|
||||
"move_attempt_count": 12
|
||||
}
|
||||
"player": {
|
||||
"id": "string",
|
||||
"name": "Pero",
|
||||
"position": {
|
||||
"x": 50,
|
||||
"y": 50
|
||||
},
|
||||
"move_count": 10,
|
||||
"move_attempt_count": 12
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
@ -293,19 +293,19 @@ GET `/game`
|
||||
Response body:
|
||||
```json
|
||||
{
|
||||
"playerId": "75bba7cd-a4c1-4b50-b0b5-6382c2822a25",
|
||||
"board": {
|
||||
"width": 101,
|
||||
"height": 101
|
||||
},
|
||||
"destinationPosition": {
|
||||
"x": 50,
|
||||
"y": 50
|
||||
},
|
||||
"playerPosition": {
|
||||
"x": 0,
|
||||
"y": 10
|
||||
}
|
||||
"playerId": "75bba7cd-a4c1-4b50-b0b5-6382c2822a25",
|
||||
"board": {
|
||||
"width": 101,
|
||||
"height": 101
|
||||
},
|
||||
"destinationPosition": {
|
||||
"x": 50,
|
||||
"y": 50
|
||||
},
|
||||
"playerPosition": {
|
||||
"x": 0,
|
||||
"y": 10
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
@ -316,8 +316,8 @@ Response body:
|
||||
|
||||
```json
|
||||
{
|
||||
"message": message_type,
|
||||
"data": ...
|
||||
"message": message_type,
|
||||
"data": ...
|
||||
}
|
||||
```
|
||||
|
||||
@ -329,101 +329,101 @@ Message: `game_dump`
|
||||
Data:
|
||||
```json
|
||||
{
|
||||
"board": {
|
||||
"width": 10,
|
||||
"height": 10
|
||||
},
|
||||
"destination": {
|
||||
"position": {
|
||||
"x": 5,
|
||||
"y": 5
|
||||
}
|
||||
},
|
||||
"players": [
|
||||
{
|
||||
"id": "test-player-pero",
|
||||
"name": "Pero",
|
||||
"active": true,
|
||||
"position": {
|
||||
"x": 3,
|
||||
"y": 3
|
||||
},
|
||||
"move_count": 0,
|
||||
"move_attempt_count": 0,
|
||||
"state": "CREATED"
|
||||
},
|
||||
{
|
||||
"id": "test-player-mirko",
|
||||
"name": "Mirko",
|
||||
"active": true,
|
||||
"position": {
|
||||
"x": 4,
|
||||
"y": 4
|
||||
},
|
||||
"move_count": 0,
|
||||
"move_attempt_count": 0,
|
||||
"state": "CREATED"
|
||||
}
|
||||
],
|
||||
"layers": [
|
||||
{
|
||||
"name": "obstacles",
|
||||
"objects": [
|
||||
{
|
||||
"type": "OBSTACLE",
|
||||
"position": {
|
||||
"x": 0,
|
||||
"y": 6
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "OBSTACLE",
|
||||
"position": {
|
||||
"x": 5,
|
||||
"y": 1
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "OBSTACLE",
|
||||
"position": {
|
||||
"x": 1,
|
||||
"y": 6
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "destination",
|
||||
"objects": [
|
||||
{
|
||||
"type": "DESTINATION",
|
||||
"position": {
|
||||
"x": 5,
|
||||
"y": 5
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "players",
|
||||
"objects": [
|
||||
{
|
||||
"type": "PLAYER",
|
||||
"position": {
|
||||
"x": 3,
|
||||
"y": 3
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "PLAYER",
|
||||
"position": {
|
||||
"x": 4,
|
||||
"y": 4
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
"board": {
|
||||
"width": 10,
|
||||
"height": 10
|
||||
},
|
||||
"destination": {
|
||||
"position": {
|
||||
"x": 5,
|
||||
"y": 5
|
||||
}
|
||||
},
|
||||
"players": [
|
||||
{
|
||||
"id": "test-player-pero",
|
||||
"name": "Pero",
|
||||
"active": true,
|
||||
"position": {
|
||||
"x": 3,
|
||||
"y": 3
|
||||
},
|
||||
"move_count": 0,
|
||||
"move_attempt_count": 0,
|
||||
"state": "CREATED"
|
||||
},
|
||||
{
|
||||
"id": "test-player-mirko",
|
||||
"name": "Mirko",
|
||||
"active": true,
|
||||
"position": {
|
||||
"x": 4,
|
||||
"y": 4
|
||||
},
|
||||
"move_count": 0,
|
||||
"move_attempt_count": 0,
|
||||
"state": "CREATED"
|
||||
}
|
||||
],
|
||||
"layers": [
|
||||
{
|
||||
"name": "obstacles",
|
||||
"objects": [
|
||||
{
|
||||
"type": "OBSTACLE",
|
||||
"position": {
|
||||
"x": 0,
|
||||
"y": 6
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "OBSTACLE",
|
||||
"position": {
|
||||
"x": 5,
|
||||
"y": 1
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "OBSTACLE",
|
||||
"position": {
|
||||
"x": 1,
|
||||
"y": 6
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "destination",
|
||||
"objects": [
|
||||
{
|
||||
"type": "DESTINATION",
|
||||
"position": {
|
||||
"x": 5,
|
||||
"y": 5
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "players",
|
||||
"objects": [
|
||||
{
|
||||
"type": "PLAYER",
|
||||
"position": {
|
||||
"x": 3,
|
||||
"y": 3
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "PLAYER",
|
||||
"position": {
|
||||
"x": 4,
|
||||
"y": 4
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
@ -433,6 +433,53 @@ Message: `product_purchase_start`
|
||||
|
||||
Data:
|
||||
```json
|
||||
{
|
||||
"player": {
|
||||
"id": "test-player-pero",
|
||||
"name": "Pero",
|
||||
"active": true,
|
||||
"position": {
|
||||
"x": 10,
|
||||
"y": 10
|
||||
},
|
||||
"move_count": 1,
|
||||
"move_attempt_count": 1,
|
||||
"state": "ON_DESTINATION"
|
||||
},
|
||||
"products": [
|
||||
{
|
||||
"name": "CocaCola",
|
||||
"id": "cocacola-id",
|
||||
"description": null
|
||||
},
|
||||
{
|
||||
"name": "Pepsi",
|
||||
"id": "pepsi-id",
|
||||
"description": null
|
||||
},
|
||||
{
|
||||
"name": "Fanta",
|
||||
"id": "fanta-id",
|
||||
"description": null
|
||||
},
|
||||
{
|
||||
"name": "Snickers",
|
||||
"id": "snickers-id",
|
||||
"description": null
|
||||
},
|
||||
{
|
||||
"name": "Mars",
|
||||
"id": "mars-id",
|
||||
"description": null
|
||||
},
|
||||
{
|
||||
"name": "Burek",
|
||||
"id": "burek-id",
|
||||
"description": null
|
||||
}
|
||||
],
|
||||
"timeout": 5
|
||||
}
|
||||
```
|
||||
|
||||
### Product purchase timer tick
|
||||
@ -441,6 +488,21 @@ Message: `product_purchase_timer_tick`
|
||||
|
||||
Data:
|
||||
```json
|
||||
{
|
||||
"time_left": 4,
|
||||
"player": {
|
||||
"id": "test-player-pero",
|
||||
"name": "Pero",
|
||||
"active": true,
|
||||
"position": {
|
||||
"x": 10,
|
||||
"y": 10
|
||||
},
|
||||
"move_count": 1,
|
||||
"move_attempt_count": 1,
|
||||
"state": "ON_DESTINATION"
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
### Product purchase timer done
|
||||
@ -449,4 +511,25 @@ Message: `product_purchase_done`
|
||||
|
||||
Data:
|
||||
```json
|
||||
{
|
||||
"player": {
|
||||
"id": "test-player-pero",
|
||||
"name": "Pero",
|
||||
"active": true,
|
||||
"position": {
|
||||
"x": 10,
|
||||
"y": 10
|
||||
},
|
||||
"move_count": 1,
|
||||
"move_attempt_count": 1,
|
||||
"state": "ON_DESTINATION"
|
||||
},
|
||||
"product": {
|
||||
"name": "CocaCola",
|
||||
"id": "cocacola-id",
|
||||
"description": null
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
If product selection timeout occured, product will be null.
|
||||
|
||||
Submodule fairhopper-sdk updated: 10290dba54...edca936325
@ -45,5 +45,5 @@ class Settings:
|
||||
ws_server: WSServerSettings
|
||||
purchase_timeout: int = 10 # seconds
|
||||
log_level: int = logging.INFO
|
||||
products: Optional[List[Product]] = None
|
||||
products: List[Product] = None
|
||||
debug: Optional[DebugSettings] = None
|
||||
|
||||
Reference in New Issue
Block a user