require "spec_helper"
require "support/array_logger"
require "support/not_so_random_generator"

require "game_runner"

RSpec.describe GameRunner do

  let(:logger) { ArrayLogger.new }
  let(:random_generator) do
    expected_results = [0.77,0.92,0.57,0.29,0.24,0.85,0.24,0.48,0.89,0.18,0.59,0.78,0.97,0.89,0.55,0.79,0.07,0.16,0.38,0.75,0.33,0.63,0.35,0.64,0.19,0.73,0.58,0.91,0.42,0.48,0.96,0.26,0.31,0.08,0.4,0.87,0.86,0.67,0.02,0.68,0.03,0.49,0.96,0.9,0.05,0.2,0.68,0.77,0.04,0.38,0.34,0.2,0.11,0.35,0.6,0.78,0.47,1,0.53,0.95,0.55,0.01,0.9,0.3,0.15,0.07,0.74,0.15,0.84,0.9,0.34,0.43,0.2,0.58,0.89,0.97,0.21,0.47,0.82,0.77,0.34,0.72,0.45,0.03,0.57,0.96,0.93,0.51,0.84,0.9,0.54,0.2,0.28,0.35,0.26,0.25,0.07,0.74,0.5,0.19,0.57,0.44,1,0.11,0.3,0.6,0.94,0.44,0.8,0.39,0.19,1,0.53,0.98,0.2,0.16,0.24,0.53,0.6,0.28,0.03,0.26,0.92,0.27,0.79,0.77,0.14,0.39,0.38,0.73,0.62,0.96,0.65,0.6,0.4,0.89,0.76,0.06,0.97,0.38,0.82,0.54,0.23,0.29,1,0.28,0.46,0.99,0.28,0.01,0.31,0.27,0.41,0.29,0.14,0.93,0.83,0.43,0.48,0.6,0.84,0.16,0.35,0.36,0.48,0.26,0.17,0.36,0.56,0.34,0.1,0.88,0.49,0.51,0.77,0.42,0.62,0.87,0.72,0.92,0.91,0.81,0.1,0.01,0.54,0.45,0.87,0.01,0.22,0.85,0.78,0.75,0.72,0.36,0.16,0.58,0.44,0.99,0.68,0.23,0.98,0.13,0.75,0.76,0.13,0.77,0.32,0.87,0.63,0.45,1,0.14,0.36,0.63,0.04,0.65,0.17,0.59,0.51,0.87,0.65,0.53,0.92,0.53,0.07,0.13,0.51,0.7,0.61,0.24,0.26,0.71,0.42,0.03,0.68,0.74,0.12,0.06,0.67,0.46,0.11,0.23,0.94,0.84,0.6,0.89,0.54,0.44,0.48,0.59,0.07,0.45,0.63,1,0.36,0.73,0.86,0.68,0.13,0.26,0.65,0.16,0.81,0.7,0.24,0.99,0.9,0.56,0.48,0.2,0.71,0.97,0.12,0.21,0.86,0.13,0.82,0.62,0.16,0.72,0.46,0.77,0.65,0.16,0.98,0.34,0.62,0.52,0.45,0.82,0.86,0.83,0.41,0.4,0.35,0.18,0.88,0.38,0.6,0.49,0.92,0.68,0.77,0.17,0.61,0.62,0.94,0.1,0.57,0.12,0.7,0.46,0.18,0.8,0.07,0.05,0.61,0.19,0.76,0.21,0.67,0.15,0.05,0.17,0.99,0.68,0.96,0.87,0.69,0.43,0.29,0.8,0.64,0.94,0.1,0.19,0.17,0.57,0.78,0.76,0.69,0.27,0.82,0.55,0.1,0.85,0.72,0.85,0.73,0.3,0.01,0.61,0.88,0.32,0.92,0.75,0.17,0.27,0.25,0.98,0.23,0.94,0.86,0.64,0.14,0.83,0.06,0.71,0.37,0.39,0.51,0.96,0.19,0.31,0.08,0.65,0.94,0.84,0.62,0.27,0.27,0.14,0.11,0.71,0.59,0.17,0.65,0.36,0.12,0.58,0.17,0.38,0.9,0.02,0.03,0.98,0.63,0.06,0.44,0.07,0.73,0.26,0.95,0.09,0.42,0.78,0.19,0.23,1,0.98,0.55,0.4,0.49,0.88,0.19,0.76,0.97,0.12,0.57,0.95,0.24,0.51,0.39,0.34,0.65,0.38,0.05,0.24,0.06,0.1,0.26,0.4,0.17,0.69,0.28,0.52,0.75,0.75,0.33,0.72,0.59,0.77,0.5,0.52,0.39,0.68,0.77,0.37,0.08,0.85,0.2,0.96,0.21,0.24,0.54,0.53,0.25,0.81,0.81,0.8,0.21,0.95,0.19,0.68,0.07,0.16,0.31,0.22,0.36,0.29,0.34,0.62,0.28,0.36,0.74,0.84,0.68,0.31,0.46,0.01,0.17,0.62,0.3,0.88,0.79,0.16,0.7,0.69,0.2,0.44,0.59,0.34,0.82,0.88,0.21,0.26,0.42,0.83,0.43,0.64,0.47,0.62,0.75,0.5,0.25,0.83,0.43,0.48,0.97,0.5,0.18,0.15,0.51,0.59,0.86,0.51,0.44,0.96,0.04,0.65,0.19,0.64,0.32,0.26,0.29,0.46,0.4,0.19,0.38,0.58,0.15,0.44,0.81,0.69,0.73,0.11,0.62,0.49,0.92,0.22,0.67,0.19,0.64,0.71,0.81,0.47,0.96,0.31,0.24,0.92,0.47,0.48,0.15,0.03,0.74,0.36,0.17,0.67,0.53,0.87,0.12,0.89,0.48,0.62,0.6,0.02,0.47,0.4,0.84,0.82,0.89,0.49,0.32,0.99,0.54,0.21,0.56,0.56,0.08,0.14,0.97,0.97,0.45,0.92,0.09,0.65,0.6,0.6,0.23,0.29,0.02,0.07,0.89,0.74,0.06,0.45,0.73,0.65,0.15,0.38,0.74,0.86,0.54,0.76,0.95,0.41,0.76,0.22,0.3,0.98,0.57,0.03,0.94,0.48,0.66,0.26,0.88,0.23,0.46,0.85,0.69,0.7,0.47,0.09,0.35,0.38,0.03,0.07,0.28,0.1,0.03,0.99,0.79,0.75,0.34,0.28,0.99,0.95,0.58,0.91,0.72,0.79,0.45,0.55,0.15,0.05,0.48,0.63,0.64,0.26,0.17,0.93,0.12,0.53,0.25,0.21,0.24,0.11,0.59,0.22,0.35,0.11,0.24,0.79,0.3,0.24,0.19,0.9,0.68,0.24,0.23,0.56,0.62,0.18,0.82,0.69,0.51,0.75,0.64,1,0.6,0.11,0.78,0.28,0.35,0.34,0.52,1,0.37,0.27,0.7,0.49,0.81,0.61,0.88,0.14,0.98,0.74,1,0.67,0.17,0.45,0.34,0.25,0.33,0.6,0.82,0.3,0.38,0.87,0.43,0.71,0.84,0.86,0.55,0.87,0.17,0.96,0.08,0.29,0.04,0.27,0.72,0.35,0.94,0.03,0.18,0.73,0.69,0.55,0.36,0.94,0.4,0.82,0.04,0.68,0.22,0.29,0.39,0.34,0.83,0.99,0.47,0.74,0.43,0.61,0.46,0.73,0.8,0.81,0.76,0.87,0.7,0.11,0.88,0.34,0.81,0.6,0.95,0.64,0.14,0.34,0.55,0.78,0.56,0.72,0.39,0.38,0.11,0.81,0.66,0.43,0.4,0.73,0.07,0.38,0.96,0.06,0.68,0.73,0.68,0.81,0.54,0.63,0.78,0.9,0.91,0.53,0.2,0.77,0.18,0.61,0.68,0.27,0.61,0.97,0.08,0.15,0.93,0.14,0.98,0.21,0.84,0.95,0.02,0.29,0.74,0.84,0.41,0.14,0.72,0.08,0.83,0.32,0.27,0.95,0.45,0.12,0.8,0.21,0.82,0.02,0.89,0.86,0.44,0.09,0.74,0.69,0.52,0.01,0.51,0.47,0.18,1,0.44,0.73,0.6,0.01,0.68,0.37,0.44,0.1,0.56,0.88,0.79,0.41,0.96,0.7,0.81,0.2,0.92,0.88,0.15,0.89,0.34,0.3,0.76,0.9,0.54,0.46,0.33,0.7,0.72,0.27,0.67,0.84,0.41,0.48,0.14,0.05,0.35,0.73,0.69,0.75,0.13,0.84,0.12,0.82,0.55,0.19,0.29,0.05,0.14,0.65,0.87,0.9,0.96,0.96,0.44,0.98,0.74,0.06,0.68,0.64,0.4,0.59,0.23,0.09,0.8,0.05,0.83,0.2,0.54,0.6,0.92,0.8,0.87,0.59,0.73,0.97,0.89,0.73,0.31,0.19,0.98,0.09,0.55,0.15,0.02,0.74,0.79,0.32,0.36,0.2,0.37,0.19,0.41,0.49,0.19,0.86,0.65,0.29,0.22,0.3,0.01,0.29,0.99,0.01,0.73,0.24,0.23,0.39,0.13,0.77,0.91,0.85,0.4,0.59,0.57,0.4,0.97,0.55,0.33,0.82,0.96,0.32,0.08,0.38,0.79,0.59,0.99,0.55,0.97,0.9,0.67,0.6,0.82,0.47,0.04,0.52,0.72,0.49,0.64,0.6,0.24,0.96,0.81,0.1,0.11,0.25,0.27,0.6,0.14,0.32,0.34,0.49,0.06,0.04,0.12,0.78,0.46,0.28,0.69,0.69,0.69,0.19,0.18,0.07,0.23,0.53]
    NotSoRandomGenerator.new(expected_results)
  end

  it "works" do
    15.times { described_class.new(random_generator, logger).run }
    verify { logger.messages }
  end

end
