Skip to content

Instantly share code, notes, and snippets.

@8th-Light-Blog
Created June 29, 2011 16:15
Show Gist options
  • Save 8th-Light-Blog/1054205 to your computer and use it in GitHub Desktop.
Save 8th-Light-Blog/1054205 to your computer and use it in GitHub Desktop.
Blog Title: Limelight Tutorial: Tic Tac Toe Example (Part 2)
Author: Paul Pagel
Date: September 29th, 2008
main do
board do
cell :id => "cell_0_0"
cell :id => "cell_0_1"
cell :id => "cell_0_2"
cell :id => "cell_1_0"
cell :id => "cell_1_1"
cell :id => "cell_1_2"
cell :id => "cell_2_0"
cell :id => "cell_2_1"
cell :id => "cell_2_2"
end
end
main do
board do
3.times do |row|
3.times do |col|
cell :id => "cell_#{row}_#{col}"
end
end
end
end
board {
width 152
height 152
border_width 1
border_color "black"
}
cell {
width 50
height 50
border_width 1
border_color "black"
}
$ jruby -S limelight open .
$ mkdir spec/players
$: << File.expand_path(File.dirname(__FILE__) + "/../players")
require File.expand_path(File.dirname(__FILE__) + "/../spec_helper")
require 'cell'
describe Cell do
include Cell
attr_accessor :id
it "should make first move an X" do
@id = "cell_0_0"
@cell_one = Limelight::Prop.new
@scene = MockScene.new
@scene.register("cell_0_0", @cell_one)
self.stub!(:scene).and_return(@scene)
mouse_clicked(nil)
@cell_one.text.should == "X"
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment