Please note: there are several branches in this repo:
- MASTER is the baseline (original) repo,
- RHN1 is the branch representing the work completed at Ruby Hack Night July,
- RHN2 is the branch representing the work completed at Ruby Hack Night September,
- RHN3 is the branch representing the work completed at Ruby Hack Night November.
During his long sea voyages, Captain Cook often retired to his cabin for long periods. The crew used to joke that he had a mistress hidden away. Soon they discovered that the Captain had simply been playing this game with the ship's scientist. Thus it came to be known as 'The Captain's Mistress’.
This repo contains an exercise for our ninth(?) workshop presented by me, David Andrews. This workshop is about teamwork and integration of much of our past workshop topics.
We have provided a repository which mimics the setup we used last time, so it should be familiar. The code to be created is found in the lib/ directory, and we have supplied the beginning of unit tests in the spec/ directory.
Here are the steps to get you started with the repo. We assume, naturally, that you have a working development machine with Ruby 1.9 or better on it. At Ryatta Group we use rbenv, and so we've included some optional elements - just skip them if you're using rvm or are not versioning your Ruby.
% git clone git@github.com:k00ka/captains-mistress.git
% cd captains-mistress
% gem install bundler
Fetching: bundler-1.7.4.gem (100%)
Successfully installed bundler-1.7.4
1 gem installed
% bundle
Fetching gem metadata from https://rubygems.org/.........
Resolving dependencies...
Installing rake 10.3.2
...
Using bundler 1.7.4
Your bundle is complete!
Use `bundle show [gemname]` to see where a bundled gem is installed.% rbenv rehashYou are (almost) there!
- The game consists of balls and a rack.
- There are 2 coloured sets of 21 balls each, coloured black and white.
- The rack has 7 channels (columns) and 6 rows.
- The rack is oriented vertically so that the balls create 7 stacks.
- Two players take turns dropping balls into the channels.
- A ball falls until it lands on top of the existing stack, or the bottom of the rack.
- Players cannot drop balls into channels that are full.
- The winner is the first player to create a line of four balls in any direction.
No, not Bejeweled.
It's Connect Four!
[see the deck for images]
- The Game and 2 Players.
- The Game entity manages
** the game board
** enforcing the rules (including flow of play), and
** game state (including winning conditions). - The Player entity answers the question
** what is your next move? - The Player entity will want to ask questions about the game state in order to make decisions.
** How do Players ask questions? Through an API!
Split up into three teams:
- Strategy Team 1
- Strategy Team 2
- Game Core Team
Game Core Team - use TDD to develop the game components
Strategy Team 1 & 2 - research play strategies
All - work together to define the API
Game Core Team - build the API
Strategy Team 1 & 2 - implement (several?) strategies
All - pit players against each other and play!
https://www.pivotaltracker.com/n/projects/1396446
http://gizmodo.com/heres-how-to-win-every-time-at-connect-four-1474572099
https://en.wikipedia.org/wiki/Connect_Four
If you want to learn (more) about TDD, there are plenty of online resources. For a quick primer, you can review our blog post from the previous workshop: [http://www.ryatta.com/refactoring-in-context/]
The first part of this project was presented at Ruby Hack Night on July 29, 2015. The output from that session is contained in the rhn1 branch.
The second part of this project as presented at Ruby Hack Night on August 27, 2015 in the rhn2 branch. Instructions are contained in the PDF available in the root of the project on the rhn2 branch. The output from that session was pushed to the rhn2 branch so we have a final record of all work.
The third part of this project is being presented at Ruby Hack Night in November.