diff --git a/.gitignore b/.gitignore index c05d955..ff64dd1 100644 --- a/.gitignore +++ b/.gitignore @@ -3,3 +3,4 @@ HRdept0819/HRstyle.css HRdept0819/index.html images/penrose.png +k-graphing/words.txt diff --git a/data/kData.json b/data/kData.json index d4f07e8..56ab819 100644 --- a/data/kData.json +++ b/data/kData.json @@ -3,34 +3,32 @@ { "name": "rock", - "attack": [ + "attack": { "past": "bludgeoned", "present": "bludgeon", "pastpart": "bludgeoned", "prespart": "bludgeoning" - } - ], + }, "strength": "heavy", "weakness": "brittle", - "image": "images/rock.png", + "image": "url('../images/k/rock.png')", "alt": "A pretty sharp and deadly looking rock.", "credit": "Metropolitan Museum of Art, CC0, via Wikimedia Commons" }, { "name": "paper", - "attack": [ + "attack": { "past":"paper cut", "present":"paper cut", "pastpart":"paper cut", "prespart":"paper cutting" - } - ], + }, "strength": "sneaky", "weakness": "floppy", - "image": "images/paper.png", + "image": "url('../images/k/paper.png')", "alt": "A crumpled ball of paper.", "credit": "found on PublicDomainPictures.net but fairly certain the original photo was taken by Porjai after some research: https://www.shutterstock.com/g/porjai+kittawornrat" }, @@ -38,17 +36,16 @@ { "name": "scissors", - "attack": [ + "attack": { "past":"stabbed", "present":"stab", "pastpart":"stabbed", "prespart":"stabbing" - } - ], + }, "strength": "pointy", "weakness": "exclusionary", - "image": "images/scissors.png", + "image": "url('../images/k/scissors.png')", "alt": "A pair of orange-handled right-handed Fiskars scissors", "credit": "Evan-amos, Public domain, via Wikimedia Commons" }, @@ -56,51 +53,47 @@ { "name": "cookie", "attack": - [ { "past": "tempted", "present": "tempt", "pastpart": "tempted", "prespart": "tempting" - } - ], + }, "strength": "delicious", "weakness": "crumbly", - "image": "images/cookie.png", + "image": "url('../images/k/cookie.png')", "alt": "A single Nantucket Pepperidge Farm chocolate chip cookie", "credit": "Evan-Amos, CC0, via Wikimedia Commons" }, { "name": "pollution", - "attack": [ + "attack": { "past": "contaminated", "present": "contaminate", "pastpart": "contaminated", "prespart": "contaminating" - } - ], + }, "strength": "omnipresent", "weakness": "toxic af", - "image": "images/pollution.png", + "image": "url('../images/k/pollution.png')", "alt": "Pink polluting smoke stacks.", "credit": "LeRoy Woodson, Public domain, via Wikimedia Commons" }, { "name": "village", - "attack": [ + "attack": { "past": "swarmed", "present": "swarm", "pastpart": "swarmed", "prespart": "swarming" - } - ], + }, "strength": "united", "weakness": "vulnerable", - "image": "images/village.png", + "image": "url('../images/k/village.png')", "alt": "A circular cropped photo of a village with red roofed houses and a spire.", "credit":"David Marcu davidmarcu, CC0, via Wikimedia Commons" @@ -108,17 +101,16 @@ { "name": "ladder", - "attack": [ + "attack": { "past": "struck", "present": "strike", "pastpart": "struck", "prespart": "striking" - } - ], + }, "strength": "elevating", "weakness": "flimsy", - "image": "images/ladder.png", + "image": "url('../images/k/ladder.png')", "alt": "The top of a yellow step ladder.", "credit":"Video Girl: https://www.publicdomainpictures.net/en/view-image.php?image=264820&picture=window-cleaners-step-ladders" }, @@ -126,45 +118,136 @@ { "name": "computer", - "attack": [ + "attack": { "past": "processed", "present": "process", "pastpart": "processed", "prespart": "processing" - } - ], + }, "strength": "efficient", "weakness": "fragile", - "image": "images/computer.png", + "image": "url('../images/k/computer.png')", "alt": "A white Apple eMac, a computer and a CRT monitor all in one.", "credit":"Evan-Amos, Public domain, via Wikimedia Commons" }, { "name": "history", - "attack": [ + "attack": { "past": "documented", "present": "document", "pastpart": "documented", "prespart": "documenting" - } - ], + }, "strength": "insightful", "weakness": "biased", - "image": "images/history.png", + "image": "url('../images/k/history.png')", "alt": "A black and white photo of a cat with a mostly obscured birthday cake.", "credit":"Frees, H. W., photographer. (ca. 1914) The Birthday Cake. , ca. 1914. June 24. [Photograph] Retrieved from the Library of Congress, https://www.loc.gov/item/2013648266/." - } + }, - ], + { + "name": "beer", + + "attack": + { + "past": "splashed", + "present": "splash", + "pastpart": "splashed", + "prespart": "splashing" + }, + + "strength": "satisfying", + "weakness": "impairing", + + "image": "url('../images/k/beer.png')", + "alt": "A yellow frothy beer in a clear glass.", + "credit": "Len Rizzi (photographer), Public domain, via Wikimedia Commons" + + }, + + { + "name": "tooth", + + "attack": + { + "past": "chomped", + "present": "chomp", + "pastpart": "chomped", + "prespart": "chomping" + }, + + "strength": "sharp", + "weakness": "sensitive", + + "image": "url('../images/k/tooth.png')", + "alt": "A giant megalodon tooth.", + "credit": "First uploader (User:TomCatX) is the author by using an image from User:Lonfat, Public domain, via Wikimedia Commons" + + }, + + { + "name": "signature", + + "attack": + { + "past": "signed away", + "present": "sign away", + "pastpart": "signed away", + "prespart": "signing away" + }, + + "strength": "binding", + "weakness": "forgeable", + + "image": "url('../images/k/signature.png')", + "alt": "Leonhard Euler's signature, but broken up into two lines.", + "credit": "Leonhard Euler, Public domain, via Wikimedia Commons" + + }, + + { + "name": "coffee", + + "attack": + { + "past": "scalded", + "present": "scald", + "pastpart": "scalded", + "prespart": "scalding" + }, + + "strength": "energizing", + "weakness": "addictive", + + "image": "url('../images/k/coffee.png')", + "alt": "A bluish white round cup full of coffee with foam art.", + "credit": "MarkJFernandes, CC0, via Wikimedia Commons" + + }, + + { + "name": "poem", + + "attack": + { + "past": "provoked", + "present": "provoke", + "pastpart": "provoked", + "prespart": "provoking" + }, + + "strength": "expressive", + "weakness": "abstract", + + "image": "url('../images/k/poem.png')", + "alt": "A rose on a cream background with illegible words taken from a postcard of James Whitcomb Riley poem.", + "credit": "Indiana State Library and Historical Bureau, Public domain, via Wikimedia Commons" + + } - "outcomes": [ - { - "win":"Your clever choice of {userWeapon} allows you to triumph over your opponent. A quick {userAttackPresent} exploits the {computerWeakness} nature of your opponent's {computerWeapon}. The {userStrength} always prevail.", - "lose":"You shouldn't have chosen a {userWeapon}. Its {userWeakness} was quickly exploited by your opponent {computerAttackPresPart} in a a quick and {computerStrength} victory.", - "tie": "... {userWeapon} ... more like a {userStrength} and {userWeakness} Spiderman meme." - } ] + } \ No newline at end of file diff --git a/images/k/beer.png b/images/k/beer.png new file mode 100644 index 0000000..86371e8 Binary files /dev/null and b/images/k/beer.png differ diff --git a/images/k/coffee.png b/images/k/coffee.png new file mode 100644 index 0000000..368d18a Binary files /dev/null and b/images/k/coffee.png differ diff --git a/k-graphing/images/computer.png b/images/k/computer.png similarity index 100% rename from k-graphing/images/computer.png rename to images/k/computer.png diff --git a/k-graphing/images/cookie.png b/images/k/cookie.png similarity index 100% rename from k-graphing/images/cookie.png rename to images/k/cookie.png diff --git a/k-graphing/images/history.png b/images/k/history.png similarity index 100% rename from k-graphing/images/history.png rename to images/k/history.png diff --git a/k-graphing/images/ladder.png b/images/k/ladder.png similarity index 100% rename from k-graphing/images/ladder.png rename to images/k/ladder.png diff --git a/k-graphing/images/paper.png b/images/k/paper.png similarity index 100% rename from k-graphing/images/paper.png rename to images/k/paper.png diff --git a/images/k/poem.png b/images/k/poem.png new file mode 100644 index 0000000..ca24c53 Binary files /dev/null and b/images/k/poem.png differ diff --git a/k-graphing/images/pollution.png b/images/k/pollution.png similarity index 100% rename from k-graphing/images/pollution.png rename to images/k/pollution.png diff --git a/k-graphing/images/rock.png b/images/k/rock.png similarity index 100% rename from k-graphing/images/rock.png rename to images/k/rock.png diff --git a/k-graphing/images/scissors.png b/images/k/scissors.png similarity index 100% rename from k-graphing/images/scissors.png rename to images/k/scissors.png diff --git a/images/k/signature.png b/images/k/signature.png new file mode 100644 index 0000000..7012bcd Binary files /dev/null and b/images/k/signature.png differ diff --git a/images/k/tooth.png b/images/k/tooth.png new file mode 100644 index 0000000..12fc5d3 Binary files /dev/null and b/images/k/tooth.png differ diff --git a/k-graphing/images/village.png b/images/k/village.png similarity index 100% rename from k-graphing/images/village.png rename to images/k/village.png diff --git a/k-graphing/k.html b/k-graphing/k.html index 12c1ad1..74d785e 100644 --- a/k-graphing/k.html +++ b/k-graphing/k.html @@ -19,7 +19,9 @@

k =

-

kittens

+

+

+

diff --git a/k-graphing/kApp.js b/k-graphing/kApp.js index 7a6f2c0..25673d0 100644 --- a/k-graphing/kApp.js +++ b/k-graphing/kApp.js @@ -2,15 +2,13 @@ const JSON_PATH = '../data/kData.json' const kView = document.getElementById('k-display') const choiceHead = document.getElementById('choice-header') const buttonContainer = document.getElementById('buttons-home') -const lifeChoices = document.getElementById('life-choices') +const autonomy = document.getElementById('autonomy') let weapons_info = [] const k = new oddInteger() kView.innerHTML = k choiceHead.innerHTML = 'Choose Wisely' - - function populate() { weapons_info = [] fetch(JSON_PATH) @@ -19,37 +17,79 @@ function populate() { let mixer = Array.from({ length: data['weapons'].length }, (value, index) => index) let mixed = mixer.sort(function(){ return 0.5 - Math.random() }) let picks = mixed.slice(0,k.getN()) - + picks.forEach(element => { weapons_info.push(data['weapons'][element]) - let button = document.createElement("button") - button.setAttribute("value", (weapons_info.length-1)) - button.setAttribute("class", 'option') - button.setAttribute("name", data['weapons'][element]['name']) - button.style.backgroundImage = 'url(' + data['weapons'][element]['image'] + ')' + let button = document.createElement('button') + button.setAttribute('value', (weapons_info.length-1)) + button.setAttribute('class', 'option') + button.setAttribute('name', data['weapons'][element]['name']) + button.style.backgroundImage = data['weapons'][element]['image'] button.innerHTML=data['weapons'][element]['name'] - button.setAttribute("title", data['weapons'][element]['alt']) - console.log(data['weapons'][element]['alt']) + button.setAttribute('title', data['weapons'][element]['alt']) buttonContainer.appendChild(button) - button.addEventListener("click", function(event) { + button.addEventListener('click', function(event) { let choice = event.target - userChoice.innerHTML = choice.name play(choice.value) }) + }) }) } function kPlusPlus() { + if (k > 49 ) { + choiceHead.innerHTML += ' NO ' + } else { k.plusPlus() kView.innerHTML = k buttonContainer.textContent = '' populate() + } } -function play(node) { - const selector = Math.floor(Math.random() * defineNumbers[n]) - let choiceString = ('selector') - lifeChoices.innerHTML = choiceString +function kMinusMinus() { + if (k < 2) { + choiceHead.innerHTML += ' NO ' + } else { + k.minusMinus() + kView.innerHTML = k + buttonContainer.textContent = '' + populate() + } +} + +function kZero() { + k.reset() + choiceHead.innerHTML = 'Choose Wisely' + kView.innerHTML = k + buttonContainer.textContent = '' + populate() + } + +function makeDudButton(element) { + let button = document.createElement('button') + button.setAttribute('class', 'option') + button.setAttribute('name', weapons_info[element]['name']) + button.style.backgroundImage = weapons_info[element]['image'] + button.innerHTML = weapons_info[element]['name'] + button.setAttribute("title", weapons_info[element]['alt']) + buttonContainer.appendChild(button) +} + + +let outcomes = [] + +function play(node) { + const selector = Math.floor(Math.random() * k.getN()) + choiceHead.innerHTML = `${weapons_info[node]['name']} vs ${weapons_info[selector]['name']}` + buttonContainer.textContent = '' + makeDudButton(node) + makeDudButton(selector) + outcomes[0] = `... ${weapons_info[node]['name']} and ${weapons_info[node]['name']} ... more like a ${weapons_info[node]['strength']} and ${weapons_info[node]['weakness']} Spiderman meme.` + outcomes[1] = `Your clever choice of ${weapons_info[node]['name']} allows you to triumph. Choosing ${weapons_info[selector]['name']}? Really? A quick ${weapons_info[node]['attack']['present']} exploits your opponent's ${weapons_info[selector]['weakness']} nature. The ${weapons_info[node]['strength']} always prevail.` + outcomes[2] = `You shouldn't have chosen ${weapons_info[node]['name']}. Its ${weapons_info[node]['weakness']} nature was quickly exploited by your opponent ${weapons_info[selector]['attack']['prespart']} you until they achieved one ${weapons_info[selector]['strength']} victory.` + autonomy.innerHTML = outcomes[k.makeDiff(node, selector)] +} \ No newline at end of file diff --git a/k-graphing/k_classes.js b/k-graphing/k_classes.js index 218b497..4b5707c 100644 --- a/k-graphing/k_classes.js +++ b/k-graphing/k_classes.js @@ -40,6 +40,10 @@ class oddInteger { } makeDiff(a, b) { - return (((a - b) % this.#n) + this.#n) % this.#n + if (this.#k === 0) { + return 0 + } else { + return Math.ceil(((((a - b) % this.#n) + this.#n) % this.#n)/this.#k) + } } } \ No newline at end of file diff --git a/k-graphing/words.txt b/k-graphing/words.txt index f55b666..79394cf 100644 --- a/k-graphing/words.txt +++ b/k-graphing/words.txt @@ -1,31 +1,3 @@ -village -ladder -pollution -computer -history - - -maintenance -beer -housing -arrival -consequence -boyfriend -mixture -tooth -bathroom -sample -orange -signature -wife -improvement -coffee -product -breath -departure -height -lady -policy poem feedback pizza diff --git a/styles/kstyle.css b/styles/kstyle.css index fe6d4fb..7ab0587 100644 --- a/styles/kstyle.css +++ b/styles/kstyle.css @@ -7,9 +7,9 @@ body { max-width:1000px; margin: auto; - font-family: "Syne Mono", monospace; - background-color: #072227; - color: #293462; + font-family: "VT323", mono; + background-color: #0B0835; + color: #060b11; } body::before { @@ -21,7 +21,7 @@ body::before { right: 0; width: 80%; height: 100%; - background-color: #ab46d250; + background-color: #170055; z-index: -2; } @@ -33,114 +33,51 @@ h1, h2, h3 { } h1, h2 { - background-color: #00fff9cc; - border-radius: 25px; - text-shadow: -1px -1px #0abdc6, - 1px 1px #7d12ff, - 2px 2px #00fff9, - 4px 4px #00b8ff, - 6px 6px #ff238e, - 9px 9px #ab46d2; + + color: #040026; + text-shadow: 1px 1px 1px #9336B4, + 2px 2px 1px #F037A5, + 2px 2px 2px #00f3fc, + 3px 3px 2px #0097ec, + 4px 4px 1px #F037A5, + 5px 5px 2px #6c1fd3, + 6px 6px 2px #040026; } h1 { - font-family: "beth ellen", handwriting; - font-size: 2.5rem; - border-bottom: 10px solid #ff238e; - width: 75%; + background: #F037A5; + border-bottom: 10px double #00f3fc; + border-top: 10px double #00f3fc; + font-size: 4rem; + width: 80%; + padding-bottom: 5px; + margin-top: 10px; } h2 { - font-size: 2.5rem; - border-top: 5px solid #ff238e; - border-bottom: 5px solid #13ABC4; + background: #F037A5; + border-bottom: 10px double #00f3fc; + border-top: 10px double #00f3fc; + font-size: 3rem; padding-top: 0px; padding-bottom: 5px; - width: 70%; + width: 80%; } h3 { - width: 70%; - font-size: 1.25rem; -} - -h3:hover{ - text-decoration:none; -} - -/* links */ - -a:link { - color:#7d12ff; -} - -a:visited{ - color:#072227; -} - -.footer:visited{ - color: #00b8ff; -} - -a:hover{ - color:#ff238e; -} - - - -ul { - display: table; - margin: auto; - border-left: 5px dotted #ff238e; - border-bottom: 5px solid #13ABC4; - background-color: #AEFEFFB3; - border-radius: 5px; - padding: 10px; - list-style-type: none; -} - -p { - max-width:70%; - margin: auto; - border-left: 5px dotted #ff238e; - border-bottom: 5px solid #13ABC4; - background-color: #AEFEFFB3; - border-radius: 5px; - padding: 10px; -} - -img { - display: table; + color:#00f3fc; + width: 65%; + padding:10px; + font-size: 2rem; margin: auto; - padding: 10px; - background-color: #ff6fb5; - border-radius: 5px; - border: 5px solid #13ABC4; -} - -form { - padding: 0px 5px 15px; - border-top-left-radius: 25px; - border-top-right-radius: 25px; - border-bottom-left-radius: 5px; - border-bottom-right-radius: 5px; - border-top: 10px double #ff238e; - border-bottom: 10px solid #13ABC4; - text-align: center; - max-width: 70%; - background-color: #AEFEFFD9; - margin: auto; - font-size: 1rem; } button { - color:#072227; - background: #00fff9cc; - background-position: center; - background-repeat: no-repeat; + + border-radius: 50%; - border: 4px outset #ff238e; + } @@ -151,6 +88,7 @@ button { justify-content: center; margin:5px; + } .choice-buttons { @@ -159,34 +97,34 @@ button { flex-wrap: wrap; justify-content: center; margin: auto; + } button.modifier { - width: 50px; - height: 50px; + padding: 5px; margin: 6px; - font-size: 1.5rem; - font-family: 'VT323', mono; + font-size: 2rem; + font-family: "VT323", mono; + background: #00f3fc; + border: 6px outset #F037A5; + } button.option { display:flex; flex-direction:column-reverse; align-items:center; - width: 120px; - height: 120px; + width: 128px; + height: 128px; padding-bottom: 2px; font-size: 1rem; font-family: 'Beth Ellen', handwriting; - margin:8px; -} - -input.text { - text-align: center; - max-width: 80%; - background-image: linear-gradient(90deg, rgba(19,171,196,1) 0%, rgba(255,111,181,1) 20%, rgba(255,255,255,1) 50%, rgba(255,111,181,1) 80%, rgba(19,171,196,1) 100%); - border-radius: 5px; + margin:12px; + background: #00f3fc; + border: 10px outset #FF3FA4; + background-position: center; + background-repeat: no-repeat; } footer {