-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy path.iex.exs
42 lines (35 loc) · 1.16 KB
/
.iex.exs
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
alias Trivia.Game
alias Trivia.GameServer
alias Trivia.Player
alias Trivia.Question
player_ruben = %Player{name: "Ruben"}
player_deisy = %Player{name: "Deisy"}
player_sofia = %Player{name: "Sofia"}
player_samuel = %Player{name: "Samuel"}
question_1 =
Question.new(%{
text: "Which franchise does the creature "Slowpoke" originate from?",
options: ["Dragon Ball", "Sonic The Hedgehog", "Yugioh"],
answer: "Pokemon"
})
question_2 =
Question.new(%{
text:
"How many Star Spirits do you rescue in the Nintendo 64 video game "Paper Mario"?",
options: ["5", "10", "12"],
answer: "7"
})
game = Game.new(%{name: "game1", player: player_ruben})
# game = Game.add_question(game, question_1)
# game = Game.add_question(game, question_2)
{:ok, game_pid} = GameServer.start_link(game)
# GameServer.start_game(game_pid)
# GameServer.add_player(game_pid, player_deisy)
# GameServer.add_player(game_pid, player_sofia)
# GameServer.add_player(game_pid, player_samuel)
start_servers = fn quantity ->
Enum.each(1..quantity, fn _iterator ->
{:ok, pid} = Trivia.DynamicSupervisor.start_child(game)
GameServer.start_game(pid)
end)
end