<commit_before>defmodule BattleSnake.GameController do
  use BattleSnake.Web, :controller

  alias BattleSnake.GameForm

  def index(conn, _params) do
    games = GameForm.all  # => nil

    game_servers = for game <- games do
      status = with [{pid, _}] <- BattleSnake.GameServer.Registry.lookup(game.id) do
        {pid, BattleSnake.GameServer.get_status(pid)}
      else
        [] -> :dead
      end
      {game, status}
    end


    render(conn, "index.html", games: games, game_servers: game_servers)
  end

  def new(conn, _params) do
    changeset = GameForm.changeset(%GameForm{})

    render(conn, "new.html", changeset: changeset)
  end

  def create(conn, %{"game_form" => params}) do
    game_form = %GameForm{}
    |> GameForm.changeset(params)
    |> Ecto.Changeset.apply_changes
    |> GameForm.save

    redirect(conn, to: game_path(conn, :edit, game_form))
  end<commit_msg>Remove comment.<commit_after>defmodule BattleSnake.GameController do
  use BattleSnake.Web, :controller

  alias BattleSnake.GameForm

  def index(conn, _params) do
    games = GameForm.all

    game_servers = for game <- games do
      status = with [{pid, _}] <- BattleSnake.GameServer.Registry.lookup(game.id) do
        {pid, BattleSnake.GameServer.get_status(pid)}
      else
        [] -> :dead
      end
      {game, status}
    end


    render(conn, "index.html", games: games, game_servers: game_servers)
  end

  def new(conn, _params) do
    changeset = GameForm.changeset(%GameForm{})

    render(conn, "new.html", changeset: changeset)
  end

  def create(conn, %{"game_form" => params}) do
    game_form = %GameForm{}
    |> GameForm.changeset(params)
    |> Ecto.Changeset.apply_changes
    |> GameForm.save

    redirect(conn, to: game_path(conn, :edit, game_form))
  end
{'fraction_non_alphanumeric': 0.12331838565022421, 'fraction_numerical': 0.0, 'mean_word_length': 3.219858156028369, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 14, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3849625', 'n_tokens_mistral': 608, 'n_tokens_neox': 585, 'n_words': 133}