-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Rob Lee
committed
Oct 23, 2011
1 parent
8bd6ccf
commit 42e5d73
Showing
8 changed files
with
186 additions
and
103 deletions.
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
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
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,9 @@ | ||
<h1>Search for an attempt</h2> | ||
|
||
<p>If you have previously submitted an attempt, then enter your token below to find it:</p> | ||
|
||
<%= form_for [@event, @attempt], :url => retrieve_event_attempts_url(@event), :method => :post, :html => { :id => 'data'} do |f| %> | ||
<%= f.label :id, 'Token' %>: | ||
<%= f.text_field :id %><br /> | ||
<%= f.submit 'Find', :class => 'btn primary' %> | ||
<% end %> |
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
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,88 @@ | ||
<%= render :partial => '/shared/flash' , :locals => {:flash => flash} %> | ||
|
||
<div class="row"> | ||
<div class="span16"> | ||
<div class="row"> | ||
<div class="span6"> </div> | ||
<div class="span2"> | ||
<div style="font-size: 35px; line-height:38px">Robot Tries</div> | ||
</div> | ||
<div class="span2"> | ||
<div id="flip-counter" class="flip-counter"></div> | ||
</div> | ||
<div class="span6"> </div> | ||
</div> | ||
</div> | ||
</div> | ||
<div class="row"> | ||
<div class="span6"> | ||
<% unless @event.twitter_account.blank? %> | ||
<p style="font-size: 20px;">Latest from twitter</p> | ||
<div id="twitter" style="width:300px"></div> | ||
<% end %> | ||
</div> | ||
<div class="span10"> | ||
<% unless @event.flickr_group_id.blank? %> | ||
<p style="font-size: 20px;">Latest from flickr</p> | ||
<div id="flickr"></div> | ||
<% end %> | ||
</div> | ||
</div> | ||
|
||
|
||
<script type="text/javascript"> | ||
//<![CDATA[ | ||
var robotcounter; | ||
function updateCounter(token) | ||
{ | ||
$.ajax({ | ||
method: 'get', | ||
url : '/events/'+token+'/counter', | ||
dataType : 'text', | ||
success: function (text) { robotcounter.setValue(parseInt(text)); } | ||
}); | ||
|
||
} | ||
$(function(){ | ||
// Initialize a new counter | ||
robotcounter = new flipCounter('flip-counter', {value: <%= @count %>, digits: 4, auto: false}); | ||
}); | ||
setInterval("updateCounter('<%=h @event.token %>')", 5000); | ||
//]]> | ||
</script> | ||
|
||
<% unless @event.twitter_account.blank? %> | ||
<script type="text/javascript"> | ||
$('#twitter').jTweetsAnywhere({ | ||
username: '<%=h @event.twitter_account %>', | ||
count: 5, | ||
showTweetFeed: { | ||
showTimestamp: { | ||
refreshInterval: 15 | ||
}, | ||
autorefresh: { | ||
mode: 'auto-insert', | ||
interval: 60 | ||
}, | ||
paging: { mode: 'none' } | ||
} | ||
}); | ||
</script> | ||
<% end %> | ||
<% unless @event.flickr_group_id.blank? %> | ||
<script type="text/javascript"> | ||
$.getJSON("http://api.flickr.com/services/feeds/groups_pool.gne?jsoncallback=?",{id:"<%=h @event.flickr_group_id %>", format: "json" }, | ||
function(data) { | ||
$.each(data.items, function(i,item){ | ||
console.log(item) | ||
console.log(item.media) | ||
$("<img/>").attr({src : item.media.m.replace('_m.','_z.')}).appendTo("#flickr"); | ||
if ( i == 3 ) { | ||
$('#flickr').coinslider({ hoverPause: false, navigation: true, width: 640, height: 400, delay: 5000 }); | ||
return false; | ||
} | ||
}); | ||
}); | ||
</script> | ||
<% end %> |
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 |
---|---|---|
@@ -1,88 +1,82 @@ | ||
<%= render :partial => '/shared/flash' , :locals => {:flash => flash} %> | ||
<h2>Intro</h2> | ||
|
||
<div class="row"> | ||
<div class="span16"> | ||
<div class="row"> | ||
<div class="span6"> </div> | ||
<div class="span2"> | ||
<div style="font-size: 35px; line-height:38px">Robot Tries</div> | ||
</div> | ||
<div class="span2"> | ||
<div id="flip-counter" class="flip-counter"></div> | ||
</div> | ||
<div class="span6"> </div> | ||
</div> | ||
</div> | ||
</div> | ||
<div class="row"> | ||
<div class="span6"> | ||
<% unless @event.twitter_account.blank? %> | ||
<p style="font-size: 20px;">Latest from twitter</p> | ||
<div id="twitter" style="width:300px"></div> | ||
<% end %> | ||
</div> | ||
<div class="span10"> | ||
<% unless @event.flickr_group_id.blank? %> | ||
<p style="font-size: 20px;">Latest from flickr</p> | ||
<div id="flickr"></div> | ||
<% end %> | ||
</div> | ||
</div> | ||
<%= render :partial => '/shared/flash', :locals => {:flash => flash} %> | ||
|
||
<p>The objective of this task is to program the robot to navigate through the maze.</p> | ||
|
||
<script type="text/javascript"> | ||
//<![CDATA[ | ||
var robotcounter; | ||
function updateCounter(token) | ||
{ | ||
$.ajax({ | ||
method: 'get', | ||
url : '/events/'+token+'/counter', | ||
dataType : 'text', | ||
success: function (text) { robotcounter.setValue(parseInt(text)); } | ||
}); | ||
|
||
} | ||
$(function(){ | ||
// Initialize a new counter | ||
robotcounter = new flipCounter('flip-counter', {value: <%= @count %>, digits: 4, auto: false}); | ||
}); | ||
setInterval("updateCounter('<%=h @event.token %>')", 5000); | ||
//]]> | ||
</script> | ||
<ol> | ||
<li>If you are doing this task for the first time, open the <%= link_to "program editor", new_event_attempt_url(@event) %> ( <%= new_event_attempt_url(@event) %> )</li> | ||
<li>If you have already done this task, but want to edit your attempt then <%= link_to 'search here', search_event_attempts_url(@event) %></li> | ||
</ol> | ||
|
||
<% unless @event.twitter_account.blank? %> | ||
<script type="text/javascript"> | ||
$('#twitter').jTweetsAnywhere({ | ||
username: '<%=h @event.twitter_account %>', | ||
count: 5, | ||
showTweetFeed: { | ||
showTimestamp: { | ||
refreshInterval: 15 | ||
}, | ||
autorefresh: { | ||
mode: 'auto-insert', | ||
interval: 60 | ||
}, | ||
paging: { mode: 'none' } | ||
} | ||
}); | ||
</script> | ||
<% end %> | ||
|
||
<% unless @event.flickr_group_id.blank? %> | ||
<script type="text/javascript"> | ||
$.getJSON("http://api.flickr.com/services/feeds/groups_pool.gne?jsoncallback=?",{id:"<%=h @event.flickr_group_id %>", format: "json" }, | ||
function(data) { | ||
$.each(data.items, function(i,item){ | ||
console.log(item) | ||
console.log(item.media) | ||
$("<img/>").attr({src : item.media.m.replace('_m.','_z.')}).appendTo("#flickr"); | ||
if ( i == 3 ) { | ||
$('#flickr').coinslider({ hoverPause: false, navigation: true, width: 640, height: 400, delay: 5000 }); | ||
return false; | ||
} | ||
}); | ||
}); | ||
</script> | ||
<% end %> | ||
<h2>Commands</h2> | ||
|
||
<p>You can control the robot using the following commands:</p> | ||
|
||
<table> | ||
<thead> | ||
<tr> | ||
<th>Command</th> | ||
<th>Alternative</th> | ||
<th>Description of command</th> | ||
<th>Example</th> | ||
</tr> | ||
</thead> | ||
<tbody> | ||
<tr> | ||
<th>forward <i><x></i></th> | ||
<th>fd <i><x></i></th> | ||
<td>Move the robot forward by <i>x</i> units.</td> | ||
<td>forward 5</td> | ||
</tr> | ||
<tr> | ||
<th>back <i><x></i></th> | ||
<th>bk <i><x></i></th> | ||
<td>Move the robot back by <i>x</i> units.</td> | ||
<td>back 5</td> | ||
</tr> | ||
<tr> | ||
<th>left <i><a></i></th> | ||
<th>lt <i><a></i></th> | ||
<td>Turn the robot <i>a</i> degrees to the left.</td> | ||
<td>left 90</td> | ||
</tr> | ||
<tr> | ||
<th>right <i><a></i></th> | ||
<th>rt <i><a></i></th> | ||
<td>Turn the robot <i>a</i> degrees to the right.</td> | ||
<td>right 90</td> | ||
</tr> | ||
<tr> | ||
<th>sleep <i><a></i></th> | ||
<th> </th> | ||
<td>The robot will sleep for <i>a</i> milliseconds.</td> | ||
<td>sleep 1000</td> | ||
</tr> | ||
|
||
</tbody> | ||
</table> | ||
|
||
<h2>More advanced control structures</h2> | ||
|
||
<table> | ||
<thead> | ||
<tr> | ||
<th>Command</th> | ||
<th>Description of expression</th> | ||
<th>Example</th> | ||
</tr> | ||
</thead> | ||
<tbody> | ||
<tr> | ||
<th>repeat <i><K></i> [ <i><commands></i> ]</th> | ||
<td>Repeat block <i><K></i>-times.</td> | ||
<td><pre> | ||
repeat 4 [ | ||
left 90 | ||
fd 5 | ||
]</pre></td> | ||
</tr> | ||
</tbody> | ||
</table> |
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
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