Sha256: 7071ca88552dc039c2efc24f4d8b152fd1a8760766a8ac7175c0afd06e8ee970

Contents?: true

Size: 1.12 KB

Versions: 1

Compression:

Stored size: 1.12 KB

Contents

require 'Matrix'
require_relative '../../lib/game_over_checker'

Before do
  @game_over_checker = GameOverChecker.new
end

Given(/^an unfoldable game board$/) do
  matrix = [[3,6,3,6],[6,3,6,3],[3,6,3,6],[6,3,6,3]]
  @state = Matrix.rows(matrix)
end

Given(/^a game board that only folds left and up$/) do
  matrix = [[0,6,3,6],[6,3,6,3],[3,6,3,6],[6,3,6,3]]
  @state = Matrix.rows(matrix)
end

Given(/^a game board that only folds left and down$/) do
  matrix = [[3,6,3,6],[6,3,6,3],[3,6,3,6],[0,3,6,3]]
  @state = Matrix.rows(matrix)
end

Given(/^a game board that only folds right and up$/) do
  matrix = [[3,6,3,0],[6,3,6,3],[3,6,3,6],[6,3,6,3]]
  @state = Matrix.rows(matrix)
end

Given(/^a game board that only folds right and down$/) do
  matrix = [[3,6,3,6],[6,3,6,3],[3,6,3,6],[6,3,6,0]]
  @state = Matrix.rows(matrix)
end

Then(/^the game is over$/) do
  expect(@game_over_checker.game_over?(@state)).to eq(true)
end

Given(/^a foldable game board$/) do
  matrix = [[3,3,3,3],[3,3,3,3],[3,3,3,3],[3,3,3,3]]
  @state = Matrix.rows(matrix)
end

Then(/^the game continues$/) do
  expect(@game_over_checker.game_over?(@state)).to eq(false)
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
threesmodel-0.0.3 features/steps/game_over_steps.rb