<commit_before>class GameController < ApplicationController
  include ApplicationHelper

  def start_game
    session.clear
    session[:game] = Codebreaker::Game.new
    session[:game].start(@request.params["diff"].to_sym)
    redirect '/play'
  end

  def play_page
    session[:error] = nil
    render("play.html.erb")
  end

  def guess
    code = @request.params["code"].split("").map{|x| x.to_i(16)}
    begin
      session[:respond] = game.guess(code)
      append_play_history([game.attempts_taken, @request.params["code"], formated_respond])
    rescue IndexError => e
      session[:error] = "You have to input #{game.symbols_count} chars."
    rescue ArgumentError => e
      session[:error] = "You have to input chars in range 1-#{game.symbols_range.to_s(16)}"
    ensure
      redirect (game.state == :playing ? '/play' : '/result')
    end<commit_msg>Errors actually show up now<commit_after>class GameController < ApplicationController
  include ApplicationHelper

  def start_game
    session.clear
    session[:game] = Codebreaker::Game.new
    session[:game].start(@request.params["diff"].to_sym)
    redirect '/play'
  end

  def play_page
    render("play.html.erb")
    session[:error] = nil
  end

  def guess
    code = @request.params["code"].split("").map{|x| x.to_i(16)}
    begin
      session[:respond] = game.guess(code)
      append_play_history([game.attempts_taken, @request.params["code"], formated_respond])
    rescue IndexError => e
      session[:error] = "You have to input #{game.symbols_count} chars."
    rescue ArgumentError => e
      session[:error] = "You have to input chars in range 1-#{game.symbols_range.to_s(16)}"
    ensure
      redirect (game.state == :playing ? '/play' : '/result')
    end
{'fraction_non_alphanumeric': 0.13876146788990826, 'fraction_numerical': 0.005733944954128441, 'mean_word_length': 3.604221635883905, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 7, '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': '3811525', 'n_tokens_mistral': 559, 'n_tokens_neox': 538, 'n_words': 123}