Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

error when game is started with no snakes #20

Open
Dkendal opened this issue Feb 15, 2017 · 0 comments
Open

error when game is started with no snakes #20

Dkendal opened this issue Feb 15, 2017 · 0 comments

Comments

@Dkendal
Copy link

Dkendal commented Feb 15, 2017

I consider this to be an edge case, and because the game dies in isolation i am totally okay with it.

Steps to recreate

  • create new game with no snakes in it

  • starts the game

  • [error] GenServer {BattleSnake.GameServer.Registry, "aeab10d7-adce-43af-b270-767a8775c2a8"} terminating

    [error] GenServer {BattleSnake.GameServer.Registry, "aeab10d7-adce-43af-b270-767a8775c2a8"} terminating
    ** (Enum.EmptyError) empty error
        (elixir) lib/enum.ex:1386: anonymous fn/0 in Enum.max_by/2
        (battle_snake) lib/battle_snake/rules.ex:17: BattleSnake.Rules.do_last_standing/1
        (elixir) lib/map.ex:646: Map.update!/3
        (elixir) lib/enum.ex:1755: Enum."-reduce/3-lists^foldl/2-0-"/3
        (battle_snake) lib/battle_snake/game_server/server.ex:110: BattleSnake.GameServer.Server.handle_info/2
        (stdlib) gen_server.erl:601: :gen_server.try_dispatch/4
        (stdlib) gen_server.erl:667: :gen_server.handle_msg/5
        (stdlib) proc_lib.erl:247: :proc_lib.init_p_do_apply/3
    Last message: :tick
    State: %BattleSnake.GameServer.State{delay: 100, game_form: %BattleSnake.GameForm{__meta__: #Ecto.Schema.Metadata<:built, "gam
    e">, delay: 100, game_mode: "singleplayer", height: 20, id: "aeab10d7-adce-43af-b270-767a8775c2a8", max_food: 4, snakes: [], width: 20, winners: [%BattleSnake.Snake{color: "", coords: [%BattleSnake.Point{x: 6, y: -1}, %BattleSnake.Point{x: 6, y: 0}, %BattleSnake.Point{x: 6, y: 1}], head_url: "", health: {:error, {:invalid, "<"}}, health_points: 97, id: "8ed9aa9b-d730-46cc-a7b0-76e29b2fcc99", name: "", taunt: nil, url: "localhost:4000"}], world: %BattleSnake.World{created_at: nil, dead_snakes: [], deaths: [], food: [%BattleSnake.Point{x: 3, y: 3}, %BattleSnake.Point{x: 16, y: 5}, %BattleSnake.Point{x: 17, y: 15}, %BattleSnake.Point{x: 14, y: 2}], game_form_id: "aeab10d7-adce-43af-b270-767a8775c2a8", game_id: "aeab10d7-adce-43af-b270-767a8775c2a8", height: 20, id: nil, max_food: 4, moves: %{}, snakes: [], turn: 0, width: 20}}, game_form_id: "aeab10d7-adce-43af-b270-767a8775c2a8", hist: [], objective: #Function<1.31983054/1 in BattleSnake.WinConditions.game_mode/1>, on_change: #Function<7.18877502/1 in BattleSnake.GameForm.to_game_server_state/1>, on_done: #Function<8.18877502/1 in BattleSnake.GameForm.to_game_server_state/1>, on_start: &BattleSnake.GameServer.State.identity/1, status: :cont, winners: [], world: %BattleSnake.World{created_at: nil, dead_snakes: [], deaths: [], food: [%BattleSnake.Point{x: 3, y: 3}, %BattleSnake.Point{x: 16, y: 5}, %BattleSnake.Point{x: 17, y: 15}, %BattleSnake.Point{x: 14, y: 2}], game_form_id: "aeab10d7-adce-43af-b270-767a8775c2a8", game_id: "aeab10d7-adce-43af-b270-767a8775c2a8", height: 20, id: nil, max_food: 4, moves: %{}, snakes: [], turn: 0, width: 20}}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant