<commit_before>require 'tictactoe_board'
require 'tictactoe_rules'
require 'comp_player'

describe CompPlayer do
  let(:ttt){TictactoeBoard.new}
  let(:ttt_rules){TictactoeRules.new}
  let(:comp_player){CompPlayer.new}

  describe '#minimax' do
    context 'a player wins' do
      it 'returns 1000 if on Xs are on the winning combo spots' do
        ttt.board = ["X", "X", "X",
                     "O", "X", "X",
                     "O", "X", "O"]
        expect(comp_player.minimax(ttt, ttt_rules)).to eq 1000
      end

      it 'returns -1000 if Os are on the winning combo spot' do
        ttt.board = ["X", "X", "O",
                     "O", "X", "X",
                     "O", "O", "O"]
        expect(comp_player.minimax(ttt, ttt_rules)).to eq -1000
      end
    end

    context 'draw' do
      it 'returns 0 if it is a draw' do
        ttt.board = ["X", "O", "X",
                     "X", "O", "O",
                     "O", "X", "O"]
        expect(comp_player.minimax(ttt, ttt_rules)).to eq 0
      end

      it 'returns 0 if it is a draw' do
        ttt.board = ["X", "O", "X",
                     "O", "O", "X",
                     "O", "X", "O"]
        expect(comp_player.minimax(ttt, ttt_rules)).to eq 0
      end
    end

    context 'one move away from win' do
      it 'returns 990 if X is one move away for a winning combo' do
        ttt = TictactoeBoard.new(["X", "X", " ", " ", " ", " ", " ", " ", " "], "X")
        expect(comp_player.minimax(ttt, ttt_rules)).to eq 990
      end
<commit_msg>Change variable name to board_arr<commit_after>require 'tictactoe_board'
require 'tictactoe_rules'
require 'comp_player'

describe CompPlayer do
  let(:ttt){TictactoeBoard.new}
  let(:ttt_rules){TictactoeRules.new}
  let(:comp_player){CompPlayer.new}

  describe '#minimax' do
    context 'a player wins' do
      it 'returns 1000 if on Xs are on the winning combo spots' do
        ttt.board_arr = ["X", "X", "X",
                         "O", "X", "X",
                         "O", "X", "O"]
        expect(comp_player.minimax(ttt, ttt_rules)).to eq 1000
      end

      it 'returns -1000 if Os are on the winning combo spot' do
        ttt.board_arr = ["X", "X", "O",
                         "O", "X", "X",
                         "O", "O", "O"]
        expect(comp_player.minimax(ttt, ttt_rules)).to eq -1000
      end
    end

    context 'draw' do
      it 'returns 0 if it is a draw' do
        ttt.board_arr = ["X", "O", "X",
                         "X", "O", "O",
                         "O", "X", "O"]
        expect(comp_player.minimax(ttt, ttt_rules)).to eq 0
      end

      it 'returns 0 if it is a draw' do
        ttt.board_arr = ["X", "O", "X",
                     "O", "O", "X",
                     "O", "X", "O"]
        expect(comp_player.minimax(ttt, ttt_rules)).to eq 0
      end
    end

    context 'one move away from win' do
      it 'returns 990 if X is one move away for a winning combo' do
        ttt = TictactoeBoard.new(["X", "X", " ", " ", " ", " ", " ", " ", " "], "X")
        expect(comp_player.minimax(ttt, ttt_rules)).to eq 990
      end

{'fraction_non_alphanumeric': 0.15305466237942122, 'fraction_numerical': 0.016720257234726688, 'mean_word_length': 1.8102981029810299, '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': '482305', 'n_tokens_mistral': 1151, 'n_tokens_neox': 1072, 'n_words': 320}