Ruby badge

Project: Tic Tac Toe

Ruby Course

Introduction

Remember Tic Tac Toe? See Wikipedia if you can’t remember the rules, or if you haven’t ever played. It involves a couple of players, a simple board, checking for victory in a game loop… all the conditions that make it a fun little problem to solve using our newfound OOP sea legs. Let’s build it!

Assignment

Build a tic-tac-toe game on the command line where two human players can play against each other and the board is displayed in between turns.

  1. Think about how you would set up the different elements within the game… What should be a class? Instance variable? Method? A few minutes of thought can save you from wasting an hour of coding.
  2. Build your game, taking care to not share information between classes any more than you have to.
  3. Post your solution below, then check out this example solution from RosettaCode.org.

Additional Resources

This section contains helpful links to other content. It isn’t required, so consider it supplemental.

Please Log In or Sign Up to view user submissions for this project!

Improve this lesson on GitHub

Have a question?

Chat with our friendly Odin community in our Discord chatrooms!

Open Discord

Are you interested in accelerating your web development learning experience?

Get started
Thinkful Logo

Thinkful

  • 5-6 months

    5-6 months

  • Job Guarantee

    Job Guarantee

  • 1-on-1 Mentorship

    1-on-1 Mentorship