An open API service indexing awesome lists of open source software.

https://github.com/maheshkumar-novice/connect-four

A command line game written in Ruby (Test Driven Development)
https://github.com/maheshkumar-novice/connect-four

connect-four rspec ruby tdd

Last synced: 3 months ago
JSON representation

A command line game written in Ruby (Test Driven Development)

Awesome Lists containing this project

README

          

# [Connect-Four](https://en.wikipedia.org/wiki/Connect_Four)
This project is part of the [The Odin Project](https://www.theodinproject.com/paths/full-stack-ruby-on-rails/courses/ruby-programming/lessons/hangman)'s Ruby curriculum.

Table Of Contents



  1. Description


  2. Demo


  3. Built With


  4. Play Online


  5. Play Local


  6. What I Learned


  7. Acknowledgements

## Description

> Connect Four is a two-player game connection board game, in which the players choose a color and then take turns dropping colored discs into seven-column, six-row vertically suspended grid. The pieces fall straight down, occupying the lowest available space within the column. The objective of the game is to be the first to form a horizontal, vertical, or diagonal line of four of one's own discs. - Wikipedia.

Using Test Driven Development style, this game is developed with Ruby. RSpec is used for TDD. TDD is in simple terms, figuring out what needs to happen, writing a failing test for it, then writing the code to make that test pass and then refactoring the code.

## Demo

![Example](./assets/example.gif)


## Built With
* Ruby
* RSpec

## Play Online

[Replit - Connect Four](https://replit.com/@MaheshkumarP/Connect-Four)

## Play Local

### Prerequisites

- Ruby (>= 2.5) - [Install](https://www.theodinproject.com/paths/full-stack-ruby-on-rails/courses/ruby-programming/lessons/installing-ruby-ruby-programming)
- RSpec - [Install](https://www.theodinproject.com/paths/full-stack-ruby-on-rails/courses/ruby-programming/lessons/introduction-to-rspec)

### Installation

```sh
git clone git@github.com:Maheshkumar-novice/connect-four.git
```

```sh
cd connect-four
```

```sh
ruby lib/main.rb
```
To run the tests,
```sh
rspec
```

## What I Learned

- How to write tests with RSpec
- How to do TDD with RSpec and Ruby
- Different ways to test methods based on the inputs and outputs
- Mocks and Stubs
- Refactoring the Code
- Splitting the problem into small steps
- Planning the solution
- Writing methods that do one thing
- Played with color texts in Terminal

## Acknowledgements

* [The Odin Project](https://theodinproject.com)
* [Replit](https://replit.com)
* [TOIlet](http://caca.zoy.org/wiki/toilet)

[Move To Top](#connect-four)