<commit_before>require 'json'

require 'tic_tac_toe'
require 'tic_tac_toe/views'

module TicTacToe

  class RackShell

    def self.new_shell
      return RackShell.new(TicTacToe::Router.new)
    end

    def initialize(router)
      @router = router
      @router.add_route("/", :GET, TicTacToe::View::Home) { |_| nil }
      @router.add_route("/new-game", :GET, TicTacToe::View::Game) do |env|
        req = Rack::Request.new(env)
        game = TicTacToe::Game.new_game(TicTacToe::Board.empty_board)
        req.session["game"] = game

        game
      end
    end

    def call(env)
      @router.match(env)
    end
  end

end
<commit_msg>Inject a player class into the rack shell<commit_after>require 'json'

require 'tic_tac_toe'
require 'tic_tac_toe/views'

module TicTacToe

  class RackShell

    def self.new_shell
      return RackShell.new(TicTacToe::Router.new, TicTacToe::Human.new)
    end

    def initialize(router, player)
      @router, @player = router, player
      player.set_shell(self)
      @router.add_route("/", :GET, TicTacToe::View::Home) { |_| nil }
      @router.add_route("/new-game", :GET, TicTacToe::View::Game) do |env|
        req = Rack::Request.new(env)
        game = TicTacToe::Game.new_game(TicTacToe::Board.empty_board)
        req.session["game"] = game

        game
      end
    end

    def call(env)
      @router.match(env)
    end
  end

end

{'fraction_non_alphanumeric': 0.12697274031563846, 'fraction_numerical': 0.0, 'mean_word_length': 2.907563025210084, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '3076577', 'n_tokens_mistral': 541, 'n_tokens_neox': 526, 'n_words': 98}