aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authors-ol <s-ol@users.noreply.github.com>2020-04-22 14:41:24 +0000
committers-ol <s-ol@users.noreply.github.com>2020-04-22 14:42:24 +0000
commit567efaae9228fe3979cf3013816f9bf23a731508 (patch)
tree333ede745aa2465ca152275a7fa8c161a020a555
parentfix titles ending with n (diff)
downloadmmm-567efaae9228fe3979cf3013816f9bf23a731508.tar.gz
mmm-567efaae9228fe3979cf3013816f9bf23a731508.zip
add games/fake-artist
-rw-r--r--root/games/$order1
-rw-r--r--root/games/fake-artist/date: time$iso8601-date1
-rw-r--r--root/games/fake-artist/description: text$plain1
-rw-r--r--root/games/fake-artist/text$html.html93
-rw-r--r--root/games/fake-artist/text$javascript.js342
-rw-r--r--root/games/fake-artist/title: text$plain1
6 files changed, 439 insertions, 0 deletions
diff --git a/root/games/$order b/root/games/$order
index aeee1d5..85fb1ff 100644
--- a/root/games/$order
+++ b/root/games/$order
@@ -10,3 +10,4 @@ moving_out
channel_83
plonat_atek
lorem_ipsum
+fake-artist
diff --git a/root/games/fake-artist/date: time$iso8601-date b/root/games/fake-artist/date: time$iso8601-date
new file mode 100644
index 0000000..5fb953f
--- /dev/null
+++ b/root/games/fake-artist/date: time$iso8601-date
@@ -0,0 +1 @@
+2020-04-22
diff --git a/root/games/fake-artist/description: text$plain b/root/games/fake-artist/description: text$plain
new file mode 100644
index 0000000..c7efb6d
--- /dev/null
+++ b/root/games/fake-artist/description: text$plain
@@ -0,0 +1 @@
+quarantine implementation of a bluffing-drawing game.
diff --git a/root/games/fake-artist/text$html.html b/root/games/fake-artist/text$html.html
new file mode 100644
index 0000000..a7c7a27
--- /dev/null
+++ b/root/games/fake-artist/text$html.html
@@ -0,0 +1,93 @@
+<!DOCTYPE html>
+<html>
+ <head>
+ <script src="https://cdnjs.cloudflare.com/ajax/libs/seedrandom/3.0.5/seedrandom.min.js"></script>
+ <style>
+ html {
+ margin: 0;
+ padding: 0;
+ background: #272727;
+
+ display: flex;
+ min-height: 100vh;
+ align-items: center;
+ overflow-y: auto;
+ }
+
+ body {
+ font-family: sans-serif;
+
+ width: 12em;
+ margin: 1em auto;
+ border: 4px solid #696969;
+ border-radius: 0.5rem;
+ background: #eeeeee;
+ overflow: hidden;
+ }
+
+ h2 {
+ display: block;
+ margin: 0;
+ padding: .5rem;
+ background: #696969;
+ color: #eeeeee;
+ }
+
+ #main, #setup {
+ padding: .5rem;
+ }
+
+ main .inner {
+ margin-bottom: .5em;
+ }
+
+ main .inner {
+ overflow: hidden;
+ max-height: 12em;
+
+ transition: all 0.3s;
+ }
+
+ main .inner > div {
+ display: flex;
+ }
+ main .inner > div > input {
+ flex: 1;
+ margin-left: 1em;
+ }
+
+ #setup {
+ display: none;
+ }
+ .setup #setup {
+ display: block;
+ }
+
+ span {
+ font-size: 2em;
+ font-weight: bold;
+ }
+ span.spy {
+ color: #c33;
+ }
+
+ a { color: inherit; }
+ </style>
+ </head>
+ <body>
+ <main>
+ <h2>Fake Artist</h2>
+ <div id="setup" class="inner">
+ <div>spies: <input id="spies" type="number" value="1" /></div>
+ <div>players:</div>
+ <ul id="players"></ul>
+ <div>
+ <button id="add">add</button>
+ <input id="name" type="text" />
+ </div>
+ </div>
+ <div id="main"></div>
+ </main>
+ <script src=":text/javascript"></script>
+ </body>
+</html>
diff --git a/root/games/fake-artist/text$javascript.js b/root/games/fake-artist/text$javascript.js
new file mode 100644
index 0000000..01880d7
--- /dev/null
+++ b/root/games/fake-artist/text$javascript.js
@@ -0,0 +1,342 @@
+const words = [
+ "airplane",
+ "alive",
+ "alligator",
+ "angel",
+ "ant",
+ "apple",
+ "arm",
+ "baby",
+ "backpack",
+ "ball",
+ "balloon",
+ "banana",
+ "bark",
+ "baseball",
+ "basketball",
+ "bat",
+ "bathroom",
+ "beach",
+ "beak",
+ "bear",
+ "bed",
+ "bee",
+ "bell",
+ "bench",
+ "bike",
+ "bird",
+ "blanket",
+ "blocks",
+ "boat",
+ "bone",
+ "book",
+ "bounce",
+ "bow",
+ "bowl",
+ "box",
+ "boy",
+ "bracelet",
+ "branch",
+ "bread",
+ "bridge",
+ "broom",
+ "bug",
+ "bumblebee",
+ "bunk bed",
+ "bunny",
+ "bus",
+ "butterfly",
+ "button",
+ "camera",
+ "candle",
+ "candy",
+ "car",
+ "carrot",
+ "cat",
+ "caterpillar",
+ "chair",
+ "cheese",
+ "cherry",
+ "chicken",
+ "chimney",
+ "clock",
+ "cloud",
+ "coat",
+ "coin",
+ "comb",
+ "computer",
+ "cookie",
+ "corn",
+ "cow",
+ "crab",
+ "crack",
+ "crayon",
+ "cube",
+ "cup",
+ "cupcake",
+ "curl",
+ "daisy",
+ "desk",
+ "diamond",
+ "dinosaur",
+ "dog",
+ "doll",
+ "door",
+ "dragon",
+ "dream",
+ "drum",
+ "duck",
+ "ear",
+ "ears",
+ "Earth",
+ "egg",
+ "elephant",
+ "eye",
+ "eyes",
+ "face",
+ "family",
+ "feather",
+ "feet",
+ "finger",
+ "fire",
+ "fish",
+ "flag",
+ "float",
+ "flower",
+ "fly",
+ "football",
+ "fork",
+ "frog",
+ "ghost",
+ "giraffe",
+ "girl",
+ "glasses",
+ "grapes",
+ "grass",
+ "hair",
+ "hamburger",
+ "hand",
+ "hat",
+ "head",
+ "heart",
+ "helicopter",
+ "hippo",
+ "hook",
+ "horse",
+ "house",
+ "ice cream cone",
+ "inchworm",
+ "island",
+ "jacket",
+ "jail",
+ "jar",
+ "jellyfish",
+ "key",
+ "king",
+ "kite",
+ "kitten",
+ "knee",
+ "ladybug",
+ "lamp",
+ "leaf",
+ "leg",
+ "legs",
+ "lemon",
+ "light",
+ "line",
+ "lion",
+ "lips",
+ "lizard",
+ "lollipop",
+ "love",
+ "man",
+ "Mickey Mouse",
+ "milk",
+ "mitten",
+ "monkey",
+ "monster",
+ "moon",
+ "motorcycle",
+ "mountain",
+ "mountains",
+ "mouse",
+ "mouth",
+ "music",
+ "nail",
+ "neck",
+ "night",
+ "nose",
+ "ocean",
+ "octopus",
+ "orange",
+ "oval",
+ "owl",
+ "pants",
+ "pen",
+ "pencil",
+ "person",
+ "pie",
+ "pig",
+ "pillow",
+ "pizza",
+ "plant",
+ "popsicle",
+ "purse",
+ "rabbit",
+ "rain",
+ "rainbow",
+ "ring",
+ "river",
+ "robot",
+ "rock",
+ "rocket",
+ "sea",
+ "seashell",
+ "sheep",
+ "ship",
+ "shirt",
+ "shoe",
+ "skateboard",
+ "slide",
+ "smile",
+ "snail",
+ "snake",
+ "snowflake",
+ "snowman",
+ "socks",
+ "spider",
+ "spider web",
+ "spoon",
+ "stairs",
+ "star",
+ "starfish",
+ "suitcase",
+ "sun",
+ "sunglasses",
+ "swimming pool",
+ "swing",
+ "table",
+ "tail",
+ "train",
+ "tree",
+ "truck",
+ "turtle",
+ "water",
+ "whale",
+ "wheel",
+ "window",
+ "woman",
+ "worm",
+ "zebra",
+ "zoo",
+];
+
+const main = document.getElementById('main');
+const players = document.getElementById('players');
+const spies = document.getElementById('spies');
+const name = document.getElementById('name');
+const add = document.getElementById('add');
+
+const shuffle = (array, rng) => {
+ for (let i = array.length - 1; i > 0; i--) {
+ let j = Math.floor(rng() * (i + 1));
+ [array[i], array[j]] = [array[j], array[i]];
+ }
+};
+
+const infect = a => {
+ a.onclick = () => {
+ const hash = a.href.split('#')[1];
+ update('#' + hash);
+ };
+};
+
+const genSeed = rng => (
+ words[Math.floor(rng() * words.length)].replace(' ', '-')
+ + '_' + words[Math.floor(rng() * words.length)].replace(' ', '-')
+ + '_' + words[Math.floor(rng() * words.length)].replace(' ', '-')
+);
+
+const update = (hash) => {
+ const [ mode, seed, n, ...names ] = hash.split(/,/);
+ const rng = new Math.seedrandom(seed);
+ const nextSeed = genSeed(rng);
+
+ while (main.lastChild)
+ main.removeChild(main.lastChild);
+
+ if (mode === '#link') {
+ document.body.className = '';
+ names.forEach((name, i) => {
+ const a = document.createElement('a');
+ a.innerText = 'play';
+ a.href = `#play,${seed},${n},${names.join(',')},${i}`;
+ infect(a);
+
+ const div = document.createElement('div');
+ div.append(`${name}: `);
+ div.append(a);
+ main.append(div);
+ });
+
+ const a = document.createElement('a');
+ a.innerText = 'next round';
+ a.href = `#link,${nextSeed},${n},${names.join(',')}`;
+ infect(a);
+ main.append(document.createElement('br'));
+ main.append(a);
+ } else if (mode === '#play') {
+ document.body.className = '';
+ const i = names.pop();
+
+ const word = words[Math.floor(rng() * words.length)];
+ const list = names.map((x, i) => i < +n);
+ shuffle(list, rng);
+
+ if (list[+i]) {
+ main.append("you are a");
+ main.append(document.createElement('br'));
+ const span = document.createElement('span');
+ span.className = 'spy';
+ span.innerText = 'SPY!';
+ main.append(span);
+ } else {
+ main.append("the word is");
+ main.append(document.createElement('br'));
+ const span = document.createElement('span');
+ span.innerText = word;
+ main.append(span);
+ }
+
+ const a = document.createElement('a');
+ a.innerText = 'next round';
+ a.href = `#play,${nextSeed},${n},${names.join(',')},${i}`;
+ infect(a);
+ main.append(document.createElement('br'));
+ main.append(a);
+ } else {
+ document.body.className = 'setup';
+ const seed = genSeed(Math.random);
+ const names = [];
+ const a = document.createElement('a');
+ a.innerText = 'start';
+ a.href = `#link,${seed},${spies.value},${names.join(',')}`;
+ main.append(a);
+ infect(a);
+
+ add.onclick = () => {
+ const li = document.createElement('li');
+ li.innerText = name.value;
+ players.append(li);
+ names.push(name.value);
+ a.href = `#link,${seed},${spies.value},${names.join(',')}`;
+ name.value = '';
+ };
+
+ spies.onchange = () => {
+ a.href = `#link,${seed},${spies.value},${names.join(',')}`;
+ }
+ }
+}
+
+update(window.location.hash);
diff --git a/root/games/fake-artist/title: text$plain b/root/games/fake-artist/title: text$plain
new file mode 100644
index 0000000..30c9364
--- /dev/null
+++ b/root/games/fake-artist/title: text$plain
@@ -0,0 +1 @@
+Fake Artist