-
Notifications
You must be signed in to change notification settings - Fork 1
/
dreamers.html
204 lines (194 loc) · 6.29 KB
/
dreamers.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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
<!DOCTYPE HTML>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.1.1/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
<script src="js/craig-util.js"></script>
<script src="js/craig-parse.js"></script>
<script src="js/dreamers.js"></script>
<script type="text/javascript" async
src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.1/MathJax.js?config=TeX-MML-AM_CHTML">
</script>
<title>Isle of Dreams</title>
</head>
<style>
ul {
padding-left: 40px;
list-style-type: none;
}
li {
padding-bottom: 10px;
}
table, tr {
padding: 4px;
text-align: center;
border: 1px solid black;
border-collapse: collapse;
margin: auto;
}
th, td {
padding: 10px;
}
.buttonDiv {
display: inline-block;
padding: 2px;
border: 2px;
}
.centered {
text-align: center;
}
.prop-column {
font-size:large;
}
.main-column {
background-color:white;
}
</style>
<script>
let dreamerData = [];
let puzzle = null;
//load data
$(document).ready(function(){
console.log("about to fetch remote data");
$.getJSON("data/dreamers.json", function(data){
dreamerData = data;
//uncomment the line below to test only puzzles that are inconsistent
//dreamerData = dreamerData.filter(p => p.is_consistent === "false");
}).done(function() {
initialize();
set();
});
});
//initialize display
$(document).ready(function(){
$("#resetButton").on("click", function(){
reset();
});
$("#solve").on("click", function(event){
if (display.disabled) return;
$("#reset").addClass("btn-success");
solvePuzzle();
});
display.puzzleIntro = document.getElementById("puzzleIntro");
display.solutionDisplay = document.getElementById("solutionDisplay");
display.puzzleDescription = document.getElementById("puzzleDescription");
display.answerDisplay = document.getElementById("answerDisplay");
display.puzzleTitle = document.getElementById("puzzleTitle");
//display.latexDisplay = document.getElementById("latexDisplay");
});
function initialize(){
dreamer.puzzles = dreamerData;
}
function reset() {
puzzleReset();
};
function set() {
puzzleReset(window.location.href);
};
</script>
<body>
<nav class="navbar navbar-default" style="margin-bottom:0px">
<div class="container-fluid">
<div class="navbar-header">
<a class="navbar-brand" href="..">
<img src="imgs/github_badge1.png" style="max-width:100%;max-height:100%" >
</a>
<p class="navbar-text navbar-right">
<a href=".." class="navbar-link">dmackinnon1.github.io</a>
</p>
</div>
</div>
</nav>
<div class="container-fluid">
<div class='row'>
<div class='col-sm-1 col-lg-3'></div>
<div class='col-sm-10 col-lg-6 main-column'>
<div class="page-header">
<h1>The Isle of Dreams</h1>
</div>
<p class='puzzle-text'>
Some logic puzzles about the Isle of Dreams, based on those found in "The Lady or the Tiger?" by Raymond Smullyan.
</p>
<button type='button'
class='btn btn-info' data-toggle='collapse' data-target='#mainText'>
About </button>
<div id='mainText' class='collapse'>
<p class='puzzle-text'>
<br>
<blockquote>
I once dreamed there was a certain island called the Isle of Dreams. The inhabitants
of this island dream quite vividly; indeed, their thoughts while asleep are as vivid as while
awake. Moreover, their dreamlife has the same continuity from night to night as their waking life has from day to day. As a result, some of the inhabitants sometimes have difficulty
in knowing whether they are awake or asleep at a given time.
</blockquote>
</div>
<hr>
<h2 id="puzzleTitle"></h2>
<div id="puzzleIntro" class='puzzle-text'></div>
<div id="puzzleDescription" class='puzzle-text'></div>
<div>
Based on their thoughts, attempt to determine if the islanders are diurnal or nocturnal,
awake, or asleep. In some cases you may not be able to determine everything about the
islanders. In some cases, the particular combination of thoughts might not be possible.
<div>
<hr>
<div id="answerDisplay"></div>
<br>
<!--
<button type='button'
class='btn btn-info' data-toggle='collapse' data-target='#latexDisplayHolder'>
Show Propositions </button>
<div id='latexDisplayHolder' class='collapse'>
<br>
<p><em>The inscriptions on the doors can be translated into logical formulae - if you are familiar with the notation, this might help you find out what is behind the doors.
Here "Xd" means that islander X is diurnal, and "Xa" means that door islander X is awake.
If an islander is not diurnal, they are nocturnal, and if they are not awake, they are asleep.
</em></p>
<div id='latexDisplay'></div>
</div>
<br>
-->
<button type='button'
class='btn btn-info' data-toggle='collapse' data-target='#hintDisplay'>
Show Hints </button>
<div id='hintDisplay' class='collapse'>
<br>
<p><em>There are 4 laws that can be deduced concerning the inhabitants of the island.
<ol>
<li> An islander while awake will believe they are diurnal.</li>
<li> An islander while asleep will believe they are nocturnal. </li>
<li> Diurnal inhabitants at all times believe they are awake. </li>
<li> Nocturnal inhabitants at all times believe they are asleep. </li>
</ol>
Try to convince yourself of each rule, and apply them to the thoughts of the
islanders in the puzzle.
</em></p>
</div>
<br>
<br>
<div id="soveButton">
<button type="button" id="solve" class="btn btn-primary typeButton">Solve</span></button>
</div>
<br>
<div id="solutionDisplay" class="puzzle-text"></div>
<hr>
<div id="resetButtonHolder">
<button type="button" id="resetButton", class="btn btn-primary typeButton">New Puzzle</span></button>
</div>
<br>
<div class='centered'>
<img src="imgs/nightmare.png" style="max-width:263px;max-height:266px" >
<br>
<p> <em>Illustration by John Waller from <br><a href='https://books.google.ca/books?id=uuQ0AAAAMAAJ'>A Treatise on the Incubus: Or Night-mare, Disturbed Sleep, Terrific Dreams,<br> and Nocturnal Visions. With the Means of Removing These Distressing Complaints</a><br>(1816).</em></p>
<br>
</div>
<br>
</div>
<div class='col-sm-1 col-lg-3'></div>
</div>
</div>
</body>
</html>