-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
added a little game (Which is correct?)
- Loading branch information
Showing
8 changed files
with
209 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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** | ||
|
||
 | ||
|
||
|
||
A bed of clams | ||
-------------- | ||
**which_is_correct_1-2.png** | ||
|
||
 | ||
|
||
|
||
A coalition of cheetahs | ||
----------------------- | ||
**which_is_correct_1-3.png** | ||
|
||
 | ||
|
||
|
||
A gulp of swallows | ||
------------------ | ||
**which_is_correct_1-4.png** | ||
|
||
 | ||
|
||
|
||
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |