Skip to content

Commit

Permalink
added a little game (Which is correct?)
Browse files Browse the repository at this point in the history
  • Loading branch information
ashbb committed May 31, 2009
1 parent 49759bd commit d73b864
Show file tree
Hide file tree
Showing 8 changed files with 209 additions and 1 deletion.
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ Worksheets
----------

- [Ruby Programming and Shoes](http://github.com/railsbridge/teachingkids/tree/master/md/Ruby_Programming_and_Shoes.md)
- [A little game (Which is correct?)](http://github.com/railsbridge/teachingkids/tree/master/md/a_little_game_which_is_correct.md)


Report from the field
Expand All @@ -21,5 +22,5 @@ Link to Sarah Allen's blog:

Change log
----------
May 31st, 2009: Added the link to Sarah Allen's field report.
May 31st, 2009: Added the link to Sarah Allen's field report and a little game (Which is correct?)
May 16th, 2009: Uploaded the resource of first lesson.
Binary file added img/which_is_correct_1-1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added img/which_is_correct_1-2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added img/which_is_correct_1-3.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added img/which_is_correct_1-4.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
127 changes: 127 additions & 0 deletions md/a_little_game_which_is_correct.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,127 @@
A little game (Which is correct?)
=================================

Which is correct?
-----------------
**which_is_correct_1-1.png**

![which_is_correct_1-1.png](http://github.com/railsbridge/teachingkids/tree/master%2Fimg%2Fwhich_is_correct_1-1.png?raw=true)


A bed of clams
--------------
**which_is_correct_1-2.png**

![which_is_correct_1-2.png](http://github.com/railsbridge/teachingkids/tree/master%2Fimg%2Fwhich_is_correct_1-2.png?raw=true)


A coalition of cheetahs
-----------------------
**which_is_correct_1-3.png**

![which_is_correct_1-3.png](http://github.com/railsbridge/teachingkids/tree/master%2Fimg%2Fwhich_is_correct_1-3.png?raw=true)


A gulp of swallows
------------------
**which_is_correct_1-4.png**

![which_is_correct_1-4.png](http://github.com/railsbridge/teachingkids/tree/master%2Fimg%2Fwhich_is_correct_1-4.png?raw=true)


Code (which_is_correct_1.rb)
----------------------------
# which_is_correct_1.rb
class OurApp < Shoes
url '/', :index

def index
clear
para "Which is correct?"
stack {
@correct = button "A bed of clams"
@wrong1 =button "A coalition of cheetahs"
@wrong2 =button "A gulp of swallows"
}

@correct.click {
clear
para "Correct"
image "http://upload.wikimedia.org/wikipedia/commons/thumb/a/ae/Balloons-aj.svg/550px-Balloons-aj.svg.png"
button "Go Back" do
visit "/"
end

}
@wrong1.click {
clear
para "Wrong!"
image "http://icanhascheezburger.files.wordpress.com/2007/05/cheez_doing_it_wrong.jpg"
button "Go Back" do
visit "/"
end
}
@wrong2.click {
clear
para "Wrong, your consolation prize is..."
image "http://farm2.static.flickr.com/1166/1230713908_083d7f6c53_o.jpg",
:width => 500
button "Go Back" do
visit "/"
end
}

end # this is the end of the index method, which lays out the "/" page

end # this is the end of the subclass, which contains all the pages (well, one page)

Shoes.app


Revised Code (which_is_correct_2.rb)
------------------------------------
# which_is_correct_1.rb
class OurApp < Shoes
url '/', :index

def index
clear
para "Which is correct?"
stack {
@correct = button "A bed of clams"
@wrong1 =button "A coalition of cheetahs"
@wrong2 =button "A gulp of swallows"
}

@correct.click {
clear
para "Correct"
image "http://upload.wikimedia.org/wikipedia/commons/thumb/a/ae/Balloons-aj.svg/550px-Balloons-aj.svg.png"
button "Go Back" do
visit "/"
end

}
@wrong1.click {
clear
para "Wrong!"
image "http://icanhascheezburger.files.wordpress.com/2007/05/cheez_doing_it_wrong.jpg"
button "Go Back" do
visit "/"
end
}
@wrong2.click {
clear
para "Wrong, your consolation prize is..."
image "http://farm2.static.flickr.com/1166/1230713908_083d7f6c53_o.jpg",
:width => 500
button "Go Back" do
visit "/"
end
}

end # this is the end of the index method, which lays out the "/" page

end # this is the end of the subclass, which contains all the pages (well, one page)

Shoes.app
45 changes: 45 additions & 0 deletions src/which_is_correct_1.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
# which_is_correct_1.rb
class OurApp < Shoes
url '/', :index

def index
clear
para "Which is correct?"
stack {
@correct = button "A bed of clams"
@wrong1 =button "A coalition of cheetahs"
@wrong2 =button "A gulp of swallows"
}

@correct.click {
clear
para "Correct"
image "http://upload.wikimedia.org/wikipedia/commons/thumb/a/ae/Balloons-aj.svg/550px-Balloons-aj.svg.png"
button "Go Back" do
visit "/"
end

}
@wrong1.click {
clear
para "Wrong!"
image "http://icanhascheezburger.files.wordpress.com/2007/05/cheez_doing_it_wrong.jpg"
button "Go Back" do
visit "/"
end
}
@wrong2.click {
clear
para "Wrong, your consolation prize is..."
image "http://farm2.static.flickr.com/1166/1230713908_083d7f6c53_o.jpg",
:width => 500
button "Go Back" do
visit "/"
end
}

end # this is the end of the index method, which lays out the "/" page

end # this is the end of the subclass, which contains all the pages (well, one page)

Shoes.app
35 changes: 35 additions & 0 deletions src/which_is_correct_2.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# which_is_correct_2.rb
class Game < Shoes
url '/', :index
url '/correct', :show_correct
url '/wrong', :show_wrong

def index
clear
para "Which is correct?"
stack {
@correct = button "A bed of clams" do
visit "/correct"
end

@wrong1 =button "A coalition of cheetahs" do
visit "/wrong"
end

@wrong2 =button "A gulp of swallows" do
visit "/wrong"
end
}
end # this is the end of the index method, which lays out the "/" page

def show_correct
para "Correct"
end # of the "correct" method, which lays out the "/correct" page

def show_wrong
para "Sorry, try again."
end # of the "wrong" method, which lays out the "/wrong2" page

end # this is the end of the "Game" subclass, which contains all pages

Shoes.app

0 comments on commit d73b864

Please sign in to comment.