Giter VIP home page Giter VIP logo

oo-tic-tac-toe's Introduction

OO Tic Tac Toe

Objectives

  1. Build a CLI Tic Tac Toe game!
  2. Encapsulate Tic Tac Toe in a TicTacToe object.

Overview

You're going to be building a 2 player CLI version of Tic Tac Toe by building a TicTacToe object. The game play will be very similar to other versions of TicTacToe.

Instructions

In order to get everything working you should refer to these instructions as you go and pay close attention to the test output.

Run bundle within this lab's directory before getting started.

Project Structure

├── Gemfile
├── Gemfile.lock
├── README.md
├── bin
│   └── tictactoe
├── lib
│   └── tic_tac_toe.rb
└── spec
    ├── 01_tic_tac_toe_spec.rb
    ├── 02_play_spec.rb
    ├── 03_cli_spec.rb
    └── spec_helper.rb

Gemfile

These files set up some tools and gems for our project and can mostly be ignored. Make sure to run bundle before starting this project so that you have all the required gems.

bin/tictactoe

This is our main executable and will be how we initialize and start our game.

lib/tic_tac_toe.rb

Our main TicTacToe class will be defined here with all the data and logic required to play a game of tic tac toe via instances of TicTacToe.

spec

There are three test files that should be completed in order. 01_tic_tac_toe_spec.rb tests our helper methods within TicTacToe. 02_play_spec.rb tests the main #play method. 03_cli_spec.rb tests the CLI.

Your Object-Oriented Tic Tac Toe

We're going to be building a very well encapsulated object for Tic Tac Toe where each instance method will represent a discrete, single responsibility or functionality of a Tic Tac Toe game.

We'll be following the Tic Tac Toe conventions of representing the board as an array with 9 elements where " " represents an empty cell in the board.

We'll be getting user input via gets and a player will choose a position by entering 1-9. Our program will then fill the appropriate position on the board with the player's token.

We will keep track of which player's turn it is and how many turns have been played. We will check to see, at every turn, if there is a winner. If there is a winner, we'll congratulate them. If there is a tie, we will inform our players.

The Logic: lib/tictactoe.rb

TicTacToe class

Open up lib/tic_tac_toe.rb. You'll be defining the main game class, TicTacToe in lib/tic_tac_toe.rb. Until the TicTacToe class is defined, everything will break.

Every method you build will be encapsulated by this class.

#initialize and @board

The first test in 01_tic_tac_toe_spec.rb will ensure the requirement that when a new game of Tic Tac Toe is started — that is, when a new instance of TicTacToe is initialized — the instance of the game must set the starting state of the board, an array with 9 empty strings " ", within an instance variable named @board.

In other words, your #initialize method should set a @board variable equal to a new, empty array that represents the game board.

WIN_COMBINATIONS

Define a WIN_COMBINATIONS constant within the TicTacToe class, and set it equal to a nested array filled with the index values for the eight winning combinations possible in Tic Tac Toe.

Top-Tip: When you see this line, TicTacToe::WIN_COMBINATIONS, in the test suite, that means the test suite is accessing the constant WIN_COMBINATIONS that was declared inside the TicTacToe class.

# within the body of TicTacToe

WIN_COMBINATIONS = [
  [0,1,2], # Top row
  [3,4,5]  # Middle row
  # et cetera, creating a nested array for each win combination
]

# the rest of the TicTacToe class definition

Helper Methods

The next bunch of methods we will be describing are helper methods - methods that will be called by other methods in your code. This keeps our code DRY and well encapsulated — each method has a single responsibility — which makes the code easier to maintain and expand.

#display_board

Define a method that prints the current board representation based on the @board instance variable.

#input_to_index

Define a method into which we can pass user input (in the form of a string, e.g., "1", "5", etc.) and have it return to us the corresponding index of the @board array. Remember that, from the player's point of view, the board contains spaces 1-9. But the indices in an array start their count at 0. If the user inputs 5, your method must correctly translate that from the player's perspective to the array's perspective — accounting for the fact that @board[5] is not where the user intended to place their token.

#move

Your #move method must take in two arguments: the index in the @board array that the player chooses and the player's token (either "X" or "O"). The second argument, the player's token, should default to "X".

#position_taken?

The #position_taken? method will be responsible for evaluating the user's desired move against the Tic Tac Toe board and checking to see whether or not that position is already occupied. Note that this method will be running after #input_to_index, so it will be checking index values. When it is passed the index value for a prospective move, #position_taken? will check to see if that position on the @board is vacant or if it contains an "X" or an "O". If the position is free, the method should return false (i.e., "the position is not taken"); otherwise, it will return true.

#valid_move?

Build a method valid_move? that accepts a position to check and returns true if the move is valid and false or nil if not. A valid move means that the submitted position is:

  1. Present on the game board.
  2. Not already filled with a token.

#turn_count

This method returns the number of turns that have been played based on the @board variable.

#current_player

The #current_player method should use the #turn_count method to determine if it is "X"'s or "O"'s turn.

#turn

Build a method #turn to encapsulate the logic of a single complete turn composed of the following routine:

  1. Ask the user for their move by specifying a position between 1-9.
  2. Receive the user's input.
  3. Translate that input into an index value.
  4. If the move is valid, make the move and display the board.
  5. If the move is invalid, ask for a new move until a valid move is received.

Note: If the user enters an invalid move, we need to repeat the entire sequence of events listed above: asking for input, translating it into an index, checking whether the move is valid and, if it is, making the move. Theoretically, we could code all that into our else but that would definitely violate DRY principles. And what if the user enters an invalid move a second or third or tenth time? What we really need to do is restart the turn method each time an invalid move is entered. Luckily, Ruby (and many other programming languages) allows us to call a method from inside itself. This process of calling a method from inside itself is commonly used in recursion.

All these procedures will be wrapped into our #turn method, but the majority of the logic for these procedures will be defined and encapsulated in our helper methods. You will need to call those methods from inside the turn method to get the tests passing. Pay close attention to the sequence of events and when and where the helper methods should be called. If there are redundancies in your code the tests may not pass.

Hint: don't forget to pay attention to which argument(s) each of your helper methods requires.

You can imagine the pseudocode for the #turn method:

ask for input
get input
translate input into index
if index is valid
  make the move for index
  show the board
else
  restart turn
end

#won?

Your #won? method should return false or nil if there is no win combination present in the board and return an array containing the winning combination indexes if there is a win. Use your WIN_COMBINATIONS constant in this method.

#full?

The #full? method should return true if every element in the board contains either an "X" or an "O".

#draw?

Build a method #draw? that returns true if the board is full and has not been won and false otherwise.

#over?

Build a method #over? that returns true if the board has been won or is full (i.e., is a draw).

#winner

Given a winning @board, the #winner method should return the token, "X" or "O", that has won the game.

Putting it all together: the #play method

#play

The play method is the main method of the Tic Tac Toe application and is responsible for the game loop. A Tic Tac Toe game must allow players to take turns, checking if the game is over after every turn. At the conclusion of the game, whether because it was won or ended in a draw, the game should report to the user the outcome of the game. You can imagine the pseudocode:

until the game is over
  take turns
end

if the game was won
  congratulate the winner
else if the game was a draw
  tell the players it ended in a draw
end

Here again, much of the functionality you need is built into our helper methods — don't forget to use them!

Run the tests for the #play method by typing rspec spec/02_play_spec.rb in your terminal.

The CLI: bin/tictactoe

Your bin/tictactoe CLI should:

  1. Instantiate an instance of TicTacToe
  2. Start the game by calling #play on that instance.

Run the tests by typing rspec spec/03_cli_spec.rb in your terminal.

oo-tic-tac-toe's People

Contributors

annjohn avatar argonity avatar aviflombaum avatar cjbrock avatar codebyline avatar drakeltheryuujin avatar gj avatar ihollander avatar laurasilvey avatar lizbur10 avatar maxwellbenton avatar mendelb avatar peterbell avatar rambllah avatar sophiedebenedetto avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

oo-tic-tac-toe's Issues

Directory error: Errno::ENOENT: No such file or directory @ rb_sysopen - --format

class TicTacToe

WIN_COMBINATIONS = [
[0, 1, 2],
[3, 4, 5],
[6, 7, 8],
[0, 3, 6],
[1, 4, 7],
[2, 5, 8],
[0, 4, 8],
[6, 4, 2]
]

def initialize
@board = Array.new(9, " ")
end

def display_board
puts " #{@board[0]} | #{@board[1]} | #{@board[2]} "
puts "-----------"
puts " #{@board[3]} | #{@board[4]} | #{@board[5]} "
puts "-----------"
puts " #{@board[6]} | #{@board[7]} | #{@board[8]} "
end

def input_to_index(user_input)
user_input.to_i - 1
end

def move(index, current_player = "X")
@board[index] = current_player
end

def position_taken?(index)
!(@board[index].nil? || @board[index] == " ")
end

def valid_move?(index)
index.between?(0,8) && !position_taken?(index)
end

def turn_count
@board.count {|x| x == "X" || x == "O"}
end

def current_player
num_turns = turn_count
if num_turns % 2 == 0
player = "X"
else
player = "O"
end
return player
end

def turn
puts "Please choose a number 1-9:"
user_input = gets.chomp
index = input_to_index(user_input)
if valid_move?(index)
player_token = current_player
move(index, player_token)
display_board
else
turn
end
end

def won?
WIN_COMBINATIONS.each {|win_combo|
index_0 = win_combo[0]
index_1 = win_combo[1]
index_2 = win_combo[2]

position_1 = @board[index_0]
position_2 = @board[index_1]
position_3 = @board[index_2]

if position_1 == "X" && position_2 == "X" && position_3 == "X"
  return win_combo
elsif position_1 == "O" && position_2 == "O" && position_3 == "O"
  return win_combo
end

}
return false
end

def full?
@board.all? {|index| index == "X" || index == "O"}
end

def draw?
if !won? && full?
return true
else
return false
end
end

def over?
if won? || draw?
return true
else
return false
end
end

def winner
index = []
index = won?
if index == false
return nil
else
if @board[index[0]] == "X"
return "X"
else
return "O"
end
end
end

def play
until over? == true
turn
end

if won?
puts "Congratulations #{winner}!"
elsif draw?
puts "Cat's Game!"
end
end

end
game = TicTacToe.new
game.play

Tests

I'm not sure if this is a big deal or not, but in all previous labs, the tests allowed me to pass the constant WIN_COMBINATIONS with [2,4,6] as one of the elements and does not require [6, 4, 2]. However, with this lab, I had to modify the constant by replacing [2,4,6] with [6,4,2](it wouldn't let me include both). After that modification, it passed.

Missing Rakefile?

The readme mentions a Rakefile, but it does not appear in the actual project structure. I wouldn't mind being able to run rake console like I could in a previous lesson.

Test Consistency

Hi, In some of the tests the positions in the board are 1-9 & in another test case it uses 0-8. Please use a consistent 1-9 approach in tests. I have added the test cases below. Thanks

Example
describe '#move' do
it 'allows "X" player in the top left and "O" in the middle' do
game = TicTacToe.new
game.move(1, "X")
game.move(5, "O")

    board = game.instance_variable_get(:@board)

    expect(board).to eq(["X", " ", " ", " ", "O", " ", " ", " ", " "])
  end
end

describe '#position_taken?' do
it 'returns true/false based on position in board' do
game = TicTacToe.new
board = ["X", " ", " ", " ", " ", " ", " ", " ", "O"]
game.instance_variable_set(:@board, board)

    position = 0
    expect(game.position_taken?(position)).to be(true)

    position = 8
    expect(game.position_taken?(position)).to be(true)

    position = 1
    expect(game.position_taken?(position)).to be(false)

    position = 7
    expect(game.position_taken?(position)).to be(false)
  end
end

Not prompted to apply

Hello,

After completing OO Tic Tac Toe (prelim work) and submitting, I don't seem to get an option for next steps. I'm wondering if anyone can look into this and let me know what the options are. All tests have been submitted and the "Track Complete" button is just greyed out and unclickable.

02_play_spec.rb - Puts Cat's Game

In the early lesson's we puts "Cats Game" if the game is draw, but in OO Tic Tac Toe lesson, spec wants us to write "Cat's Game". It's a really minor typo but you may want to change it.

Thank you.

The new Learn IDE cannot open this lesson.

After installing the Lear IDE this lesson does not open properly anymore .

Thats the error message i get :

s/oo-tic-tac-toe-q-000/.learn (Errno::ENOENT)                                   
        from /usr/local/rvm/gems/ruby-2.2.3/gems/learn-open-1.1.59/lib/learn_ope
n/opener.rb:232:in ios_lesson?'                                                         from /usr/local/rvm/gems/ruby-2.2.3/gems/learn-open-1.1.59/lib/learn_ope n/opener.rb:297:in bundle_install'                                             
        from /usr/local/rvm/gems/ruby-2.2.3/gems/learn-open-1.1.59/lib/learn_ope
n/opener.rb:33:in run'                                                                  from /usr/local/rvm/gems/ruby-2.2.3/gems/learn-open-1.1.59/lib/learn_ope n/opener.rb:7:in run'                                                          
        from /usr/local/rvm/gems/ruby-2.2.3/gems/learn-open-1.1.59/bin/learn-ope
n:7:in <top (required)>'                                                                from /usr/local/rvm/gems/ruby-2.2.3/bin/learn-open:23:in load'         
        from /usr/local/rvm/gems/ruby-2.2.3/bin/learn-open:23:in <main>'                from /usr/local/rvm/gems/ruby-2.2.3/bin/ruby_executable_hooks:15:in eva
l'                                                                              
        from /usr/local/rvm/gems/ruby-2.2.3/bin/ruby_executable_hooks:15:in `'                                                     

#won? requirements are contradicting compared to spec test in 01_tic_tac_toe_spec.rb

On the website we are asked to have the #won? method to return the winning combination as an array. However in 01_tic_tac_toe_spec.rb the test for a win is expecting a boolean value of "true." For my submission I edited the spec file and copied the code from game_status_spec.rb located in ttt-game-status-ruby-intro-000\spec for the #won? method's win tests for this project.

Regardless of which one was wanted, it should be corrected as it can be confusing.

Thanks for taking the time to read this.

Inconsistent instructions

README says:

#position_taken?

The #position_taken? method will be responsible for evaluating the user's input against the Tic Tac Toe board and checking to see whether or not that position is occupied. If the user inputs that they would like to fill out position 2, our #position_taken? method will check to see if that position is vacant or if it contains an "X" or and "O". If the position is free, the method should return false (i.e. "not taken"), otherwise it will return true. This method will also deal with 'user friendly' data (a String with a 1-9 number)

but 01_tic_tac_toe_spec.rb tests:

    position = 0
    expect(game.position_taken?(position)).to be(true)

position given is not "user-friendly," it is a 0-based index.

Purely object-oriented code not passing

Code written in purely object-oriented style will not pass 3 tests, because in 3 places the spec invokes the methods passing in arguments. Should/could be adjusted?

Lessons

I have completed my Intro to Ruby and Object orientation lessons- but for whatever reason I don't see where I can move on. It is keeping on those lessons that I have already completed

positions as ints then strings then 0-based then 1-based...why?

Ok maybe I'm confused but the spec is using "position" as integers for some checks, strings for other checks, is sometimes based on 0..8 and other times 1..9. What is going on here?
eg: see below
describe '#position_taken?' do
it 'returns true/false based on position in board' do
game = TicTacToe.new
board = ["X", " ", " ", " ", " ", " ", " ", " ", "O"]
game.instance_variable_set(:@board, board)

    position = 0
    expect(game.position_taken?(position)).to be(true)

    position = 8
    expect(game.position_taken?(position)).to be(true)

    position = 1
    expect(game.position_taken?(position)).to be(false)

    position = 7
    expect(game.position_taken?(position)).to be(false)
  end
end

describe '#valid_move?' do
  it 'returns true/false based on position' do
    game = TicTacToe.new
    board = [" ", " ", " ", " ", "X", " ", " ", " ", " "]
    game.instance_variable_set(:@board, board)

    position = "1"
    expect(game.valid_move?(position)).to be_truthy

    position = "5"
    expect(game.valid_move?(position)).to be_falsey

    position = "invalid"
    expect(game.valid_move?(position)).to be_falsey
  end
end

CLI code already done when forked lab

9/13/18 4:15pm
Heads up that when I forked this lab today using local IDE, the ./bin/tictactoe
file already contained the "answer" code as requested in lab instructions.

Strip video?

Not sure that the video adds much value here, particularly seeing as the user has already built a tictactoe game.

The test 'defines a constant WIN_COMBINATIONS with arrays for each win combination' too specific

Error Feedback:

  1. ./lib/tic_tac_toe.rb TicTacToe WIN_COMBINATIONS defines a constant WIN_COMBINATIONS with arrays for each win combination
    Failure/Error: expect(TicTacToe::WIN_COMBINATIONS).to include([6,4,2])
    expected [[0, 1, 2], [3, 4, 5], [6, 7, 8], [0, 3, 6], [1, 4, 7], [2, 5, 8], [0, 4, 8], [2, 4, 6]] to include [6, 4, 2]

    ./spec/01_tic_tac_toe_spec.rb:51:in `block (4 levels) in <top (required)>'

Issue:
[2,4,6] is the same as [6,4,2]. The test 'defines a constant WIN_COMBINATIONS with arrays for each win combination' is too specific and doesn't account for potential variations in array value orders.

Opportunity to do more?

The port to make TTT work in object oriented way was very minimal, mostly just encapsulating the methods as instance methods and have them all use the board instance variable. Maybe too straightforward?

I felt like armed with knowledge of OO, this would be an opportunity to somehow extend my TicTacToe game is some interesting way. Like maybe by introducing the notion of a Player object that has a name? Or introducing an AI with different strategies? Not sure, just felt like something "more" would make this lab feel more rewarding.

Be more explicit about asking user to re-use old code

I think the only way this lab is palatable is by opening previous CLI implementation and copying over methods & adjusting them as necessary, rather than writing from scratch. Maybe the lesson description should clearly suggest that?

Spec failures

Files 01_tic_tac_toe_spec and 02_play_spec has an error. There were no single quotes around the Tic Tac Toe in: describe TicTacToe do

As a result there were errors.

the move test uses computer science indeces instead of the user friendly 1 and 5

Two of the tests conflict eachother... the input_to_index tests asks you to allow the user input 1-9 however later on the move calls move(0,"X") and move(4,"O") expecting the board to look like ["X", " ", " ", " ", "O", " ", " ", " ", " "]

The code of the test in question is below. I changed the test to move(1,"X") and move(5,"O") to keep the two tests consistent...

describe '#move' do
it 'allows "X" player in the top left and "O" in the middle' do
game = TicTacToe.new
game.move(1, "X")
game.move(5,"O")

    board = game.instance_variable_get(:@board)

    expect(board).to eq(["X", " ", " ", " ", "O", " ", " ", " ", " "])
  end
end

end

the status of Open a pull request on Github can not updated

the status of Open a pull request on Github can not updated even I submitted succeed:

➜ oo-tic-tac-toe-002 git:(master) learn submit
Adding changes...
Committing changes...
It looks like you have no changes to commit. Will still try updating your submission...
Pushing changes to GitHub...
Submitting lesson...
Done.
➜ oo-tic-tac-toe-002 git:(master)

Hit an issue with pry, running inside pry gem

When trying to call binding.pry within a function, pry instead returned the code within its gem rather than the function it was called in. I was able to use 'byebug' to debug instead of pry, couldn't find a solution for how to call pry.

In gemfile - gem 'byebug'
in tic_tac_toe.rb - require 'byebug' - then call using byebug

Return from calling binding.pry:

From: /home/jon-laptop/.rvm/gems/ruby-2.6.3/gems/pry-nav-0.3.0/lib/pry-nav/tracer.rb @ line 21 PryNav::Tracer#run:

12: def run(&block)
13:   # For performance, disable any tracers while in the console.
14:   # Unfortunately doesn't work in 1.9.2 because of
15:   # http://redmine.ruby-lang.org/issues/3921. Works fine in 1.8.7 and 1.9.3.
16:   stop unless RUBY_VERSION == '1.9.2'
17: 
18:   return_value = nil
19:   command = catch(:breakout_nav) do      # Coordinates with PryNav::Commands
20:     return_value = yield

=> 21: {} # Nothing thrown == no navigational command
22: end
23:
24: # Adjust tracer based on command
25: if process_command(command)
26: start
27: else
28: stop if RUBY_VERSION == '1.9.2'
[1] pry(#PryNav::Tracer)> exit

WIN_COMBINATIONS Bug

When I ran the test on my code, the output gave me an error because my WIN_COMBINATIONS did not include [6, 4, 2] even though I had included [2, 4, 6]. When I changed the latter to the former, the test ran with no failures. I copied and pasted my WIN_COMBINATIONS (which had the 2, 4, 6 order) from past labs, which passed then.

#position_taken? in OO Tic Tac Toe

The README says:
"#POSITION_TAKEN?
The #position_taken? method will be responsible for evaluating the user's input against the Tic Tac Toe board and checking to see whether or not that position is occupied. If the user inputs that they would like to fill out position 2, our #position_taken? method will check to see if that position is vacant or if it contains an "X" or and "O". If the position is free, the method should return false (i.e. "not taken"), otherwise it will return true. This method will also deal with 'user friendly' data (a String with a 1-9 number)"

I kept accounting for the 'user friendly' data, and my method would not pass...when i did NOT account for it, it did pass. When i checked the specs I realized they were testing for the index, and did not require an to_i at all.

Just sayin'.
Thanks

Test for #winner uses impossible games

Here is the test for #winner:

    describe '#winner' do
      it 'return X when X won' do
        game = TicTacToe.new
        board = ["X", " ", " ", " ", "X", " ", " ", " ", "X"]
        game.instance_variable_set(:@board, board)

        expect(game.winner).to eq("X")
      end

      it 'returns O when O won' do
        game = TicTacToe.new
        board = ["X", "O", " ", " ", "O", " ", " ", "O", "X"]
        game.instance_variable_set(:@board, board)

        expect(game.winner).to eq("O")
      end

      it 'returns nil when no winner' do
        game = TicTacToe.new
        board = ["X", "O", " ", " ", " ", " ", " ", "O", "X"]
        game.instance_variable_set(:@board, board)

        expect(game.winner).to be_nil
      end

Only the "no winner" portion of this test uses a board that could occur during legal play. The unfortunate effect of this is that there exist creative solutions which will display the winner correctly 100% of the time the game is played, but still not pass this test. Here is an example:

  def winner
    turn_count % 2 == 0 ? "O" : "X" if won?
  end

It's the reverse of #current_player, and that's by design. If the game board shows a win and it's your turn, you just lost! I know there are many ways to code #winner so that it displays the type of token in the winning positions, it was just disappointing to see a working solution fail the test for no good reason.

If you agree that there is no harm to the test using possible game boards, you are welcome to use my edited version of the test:

    describe '#winner' do
      it 'return X when X won' do
        game = TicTacToe.new
        board = ["X", "O", "O", " ", "X", " ", " ", " ", "X"]
        game.instance_variable_set(:@board, board)

        expect(game.winner).to eq("X")
      end

      it 'returns O when O won' do
        game = TicTacToe.new
        board = ["X", "O", "X", " ", "O", " ", " ", "O", "X"]
        game.instance_variable_set(:@board, board)

        expect(game.winner).to eq("O")
      end

      it 'returns nil when no winner' do
        game = TicTacToe.new
        board = ["X", "O", " ", " ", " ", " ", " ", "O", "X"]
        game.instance_variable_set(:@board, board)

        expect(game.winner).to be_nil
      end
    end

The parts of the test for #play that rely on determining a winner from an impossible board would need tweaking as well:

describe '#play' do
#...
      it 'congratulates the winner X' do
        game = TicTacToe.new
        board = ["X", "X", "X", "O", "O", " ", " ", " ", " "]
        game.instance_variable_set(:@board, board)
        allow($stdout).to receive(:puts)

        expect($stdout).to receive(:puts).with("Congratulations, X!")

        game.play
      end

      it 'congratulates the winner O' do
        game = TicTacToe.new
        board = ["X", "X", " ", "X", " ", " ", "O", "O", "O"]
        game.instance_variable_set(:@board, board)

        allow($stdout).to receive(:puts)

        expect($stdout).to receive(:puts).with("Congratulations, O!")

        game.play
      end
#...
end

(snuck in some grammar fixes for the congratulation messages too ;)

Turn Method

The tests call for the board to be displayed once but the solution displays the board twice.

def turn
display_board
puts "Please enter 1-9:"
input = gets.strip
if !valid_move?(input)
turn
end
move(input, current_player)
display_board
end

Corresponding error message:

Failures:

  1. ./lib/tic_tac_toe.rb TicTacToe#turn makes valid moves and displays the board
    Failure/Error: expect(game).to receive(:display_board)
    (#TicTacToe:0x00000001ce98d8).display_board(*(any args))
    expected: 1 time with any arguments
    received: 2 times with any arguments

    ./spec/01_tic_tac_toe_spec.rb:109:in `block (4 levels) in <top (required)>'

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.