-
Notifications
You must be signed in to change notification settings - Fork 0
/
Types.fs
105 lines (83 loc) · 2.13 KB
/
Types.fs
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
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
module AiMafia.Types
[<RequireQualifiedAccess>]
type PlayerRole =
| AI
| Human
type GptChatInfo = { SystemMsg: string }
[<RequireQualifiedAccess>]
type ControlType =
| AI of GptChatInfo
| Human
type Player =
{ Name: string
Role: PlayerRole
ControlledBy: ControlType }
type Dialogue = { Player: Player; Line: string }
type Vote =
{ By: Player
For: Player
Reason: string }
// Todo - add stage starting event
type Event =
| Conv of Dialogue
| VoteCast of Vote
| HungVote of Vote list
| Elimination of Player
[<RequireQualifiedAccess>]
type GameEvent =
| Public of Event
| Private of Event
member this.IsPrivateEvent =
match this with
| GameEvent.Private _ -> true
| _ -> false
member this.IsPublicEvent =
match this with
| GameEvent.Public _ -> true
| _ -> false
member this.IsElimination =
match this with
| GameEvent.Public event ->
match event with
| Conv _
| VoteCast _
| HungVote _ -> false
| Elimination _ -> true
| GameEvent.Private event ->
match event with
| Conv _
| VoteCast _
| HungVote _ -> false
| Elimination _ -> true
type RoundType =
| PrivateVoting
| PublicVoting
override this.ToString() =
match this with
| PrivateVoting -> "Private voting"
| PublicVoting -> "Public voting"
type Round = { Number: int; Type: RoundType }
[<RequireQualifiedAccess>]
type GameSummary =
| Public of string
| Private of string
member this.IsPublicSummary =
match this with
| Public _ -> true
| _ -> false
member this.IsPrivateSummary =
match this with
| Private _ -> true
| _ -> false
member this.Value =
match this with
| Public s
| Private s -> s
type GameState =
{ Round: Round
Players: Player list
GameEvents: GameEvent list
GameEventSummary: GameSummary list }
type GameConfig =
{ HasRealHuman: bool
NumberOfPlayers: int }