This particular game of tic-tac-toe is played entirely in the terminal. There is a basic interface that displays the board in between turns. Each player's score is tracked in between matches.
Among the necessary skills required to complete this project, I learned about:
- Organize code with separate files for classes/methods and using require_relative
- Design with an object-oriented approach in mind
- Using private methods to prevent oversharing of classes (inside tic_tac_toe.rb in this project)
- Using a module to group related methods together
- Using classes from which to create methods and objects from
- Instantiating new objects from a classes
- Using instance variables to track the state of each instance
- Using setter and getter methods when working with instance variables
- Frozen string literals and how it would affect modifying strings
- Adding comments to describe a module or class
- Using hashes to store information
- Creating predicate methods instead of resorting to repeated
if..else
statements - Looping through nested arrays (to check if a user has won in this case)
- Using a linter to help improve code legibility