-
-
Notifications
You must be signed in to change notification settings - Fork 4
/
index.html
58 lines (55 loc) · 3.5 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" lang="en">
<head>
<meta charset="utf-8" />
<title>Parachuting robots</title>
<meta name="author" content="David Peter">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="description" content="Interactive version of robots with parachutes puzzle.">
<link href="main.css" rel="stylesheet" type="text/css">
<link href="https://fonts.googleapis.com/css?family=Roboto+Condensed:400,700%7CSource+Code+Pro" rel="stylesheet" type="text/css">
<link href="bower_components/font-awesome/css/font-awesome.min.css" rel="stylesheet" type="text/css">
</head>
<body>
<div id="outer">
<div id="container">
<h1>Two robots with parachutes</h1>
<blockquote>
This classic puzzle can be found on <a href="https://www.ocf.berkeley.edu/~wwu/riddles/cs.shtml#robotCollisionProg">many</a> <a href="https://en.wikibooks.org/wiki/Puzzles/Logic_puzzles/Parachuted_Robots">different</a> <a href="https://stackoverflow.com/questions/25596473/two-robots-on-a-line">websites</a> (Spoilers!). It seems to originate from a Microsoft interview question. This is an interactive version of the puzzle where you can immediately try your ideas.
</blockquote>
<p>
Two robots are to be parachuted onto random locations on an
infinite line. When they land, their parachutes detach and remain
where they are. The robots may be programmed from the following
instruction set:
</p>
<table class="instructions">
<tr><td><code>left</code></td><td>Go left one unit</td></tr>
<tr><td><code>right</code></td><td>Go right one unit</td></tr>
<tr><td><code>skipNext</code></td><td>Skip next instruction if there is a parachute here</td></tr>
<tr><td><code>goto <i>label</i></code></td><td>Go to label</td></tr>
</table>
<p>
Each of these instruction can be prepended by an optional label (<code><i>label</i>: instruction</code>).
</p>
<p>
Your goal is to program the robots to meet (collide). They both run the same code.
</p>
<div id="component">Loading ...</div>
<p class="credits">
A game by <a href="https://david-peter.de/">David Peter</a>. Source code on <a href="https://github.com/sharkdp/parachuting-robots">Github</a>.<br>
<iframe id="ghstars" src="https://ghbtns.com/github-btn.html?user=sharkdp&repo=parachuting-robots&type=star&count=true" style="width: 80px; height: 20px; border: none; overflow: hidden"></iframe>
</p>
</div>
</div>
<script type="text/javascript" src="main.js"></script>
<script>
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','//www.google-analytics.com/analytics.js','ga');
ga('create', 'UA-39945208-2', 'david-peter.de');
ga('send', 'pageview');
</script>
</body>
</html>