-
Notifications
You must be signed in to change notification settings - Fork 26
/
Copy pathtypes.d.ts
77 lines (66 loc) · 1.18 KB
/
types.d.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
// API Types
// https://docs.battlesnake.com/api
export interface Coord {
x: number;
y: number;
}
export interface Battlesnake {
id: string;
name: string;
health: number;
body: Coord[];
head: Coord;
length: number;
latency: string;
shout: string;
customizations: Customizations;
}
export interface Customizations {
color: string;
head: string;
tail: string;
}
export interface Board {
height: number;
width: number;
food: Coord[];
hazards: Coord[];
snakes: Battlesnake[];
}
export interface GameState {
game: Game;
turn: number;
board: Board;
you: Battlesnake;
}
export interface Game {
id: string;
ruleset: Ruleset;
map: string;
source: string;
timeout: number;
}
export interface Ruleset {
name: string;
version: string;
settings: RulesetSettings;
}
export interface RulesetSettings {
foodSpawnChance: number;
minimumFood: number;
hazardDamagePerTurn: number;
}
// Response Types
// https://docs.battlesnake.com/api
export interface InfoResponse {
apiversion: string;
author?: string;
color?: string;
head?: string;
tail?: string;
version?: string;
}
export interface MoveResponse {
move: string;
shout?: string;
}