-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbandwagoner.gleam
45 lines (37 loc) · 890 Bytes
/
bandwagoner.gleam
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
pub type Coach {
Coach(
name: String,
former_player: Bool,
)
}
pub type Stats {
Stats(
wins: Int,
losses: Int
)
}
pub type Team {
Team(
name: String,
coach: Coach,
stats: Stats
)
}
pub fn create_coach(name: String, former_player: Bool) -> Coach {
Coach(name, former_player)
}
pub fn create_stats(wins: Int, losses: Int) -> Stats {
Stats(wins, losses)
}
pub fn create_team(name: String, coach: Coach, stats: Stats) -> Team {
Team(name, coach, stats)
}
pub fn replace_coach(team: Team, coach: Coach) -> Team {
Team(..team, coach: coach)
}
pub fn is_same_team(home_team: Team, away_team: Team) -> Bool {
home_team == away_team
}
pub fn root_for_team(team: Team) -> Bool {
team.name == "Chicago Bulls" || team.coach.name == "Gregg Popovich" || team.coach.former_player || team.stats.wins >= 60 || team.stats.losses > team.stats.wins
}