Refactor code in computer_player.rb