From 458b7c751615bef47e81e5e48d0a9e91f161ed16 Mon Sep 17 00:00:00 2001 From: thejackal360 Date: Fri, 8 Dec 2023 08:19:36 -0800 Subject: [PATCH 1/3] Explain how kiwis work in game --- src/elena/templates/elena.js | 5 +++++ src/example/static/js/games/Bacterial Culture_elena.js | 5 +++++ .../static/js/games/Temperature Controller Part II_elena.js | 5 +++++ .../static/js/games/Temperature Controller Part I_elena.js | 5 +++++ src/example/templates/elena.js | 5 +++++ 5 files changed, 25 insertions(+) diff --git a/src/elena/templates/elena.js b/src/elena/templates/elena.js index 103e9c8..c2e890d 100644 --- a/src/elena/templates/elena.js +++ b/src/elena/templates/elena.js @@ -56,6 +56,11 @@ function {{ module_name }}_convo(val) { // Race condition: No youHold and no more chelsea_msgs // Need to hold until you generate topic content. chelsea_msgs.push("Good to meet you, " + val); + chelsea_msgs.push("Answer trivia questions to earn 🥝s."); + if ({{ module_name }}NumTopics > 1) { + chelsea_msgs.push("Pay 🥝s to play mini games."); + } + chelsea_msgs.push("Let's get started!"); topic = {{ module_name }}_randint_topics(); {{ module_name }}_convo(val); } else if (topic == {{ module_name }}TriviaTopic) { diff --git a/src/example/static/js/games/Bacterial Culture_elena.js b/src/example/static/js/games/Bacterial Culture_elena.js index b984212..8c97adc 100644 --- a/src/example/static/js/games/Bacterial Culture_elena.js +++ b/src/example/static/js/games/Bacterial Culture_elena.js @@ -56,6 +56,11 @@ function Bacterial_Culture_convo(val) { // Race condition: No youHold and no more chelsea_msgs // Need to hold until you generate topic content. chelsea_msgs.push("Good to meet you, " + val); + chelsea_msgs.push("Answer trivia questions to earn 🥝s."); + if (Bacterial_CultureNumTopics > 1) { + chelsea_msgs.push("Pay 🥝s to play mini games."); + } + chelsea_msgs.push("Let's get started!"); topic = Bacterial_Culture_randint_topics(); Bacterial_Culture_convo(val); } else if (topic == Bacterial_CultureTriviaTopic) { diff --git a/src/example/static/js/games/Temperature Controller Part II_elena.js b/src/example/static/js/games/Temperature Controller Part II_elena.js index 0db1732..d55f359 100644 --- a/src/example/static/js/games/Temperature Controller Part II_elena.js +++ b/src/example/static/js/games/Temperature Controller Part II_elena.js @@ -56,6 +56,11 @@ function Temperature_Controller_Part_II_convo(val) { // Race condition: No youHold and no more chelsea_msgs // Need to hold until you generate topic content. chelsea_msgs.push("Good to meet you, " + val); + chelsea_msgs.push("Answer trivia questions to earn 🥝s."); + if (Temperature_Controller_Part_IINumTopics > 1) { + chelsea_msgs.push("Pay 🥝s to play mini games."); + } + chelsea_msgs.push("Let's get started!"); topic = Temperature_Controller_Part_II_randint_topics(); Temperature_Controller_Part_II_convo(val); } else if (topic == Temperature_Controller_Part_IITriviaTopic) { diff --git a/src/example/static/js/games/Temperature Controller Part I_elena.js b/src/example/static/js/games/Temperature Controller Part I_elena.js index 8f1ad2f..bc3b7d4 100644 --- a/src/example/static/js/games/Temperature Controller Part I_elena.js +++ b/src/example/static/js/games/Temperature Controller Part I_elena.js @@ -56,6 +56,11 @@ function Temperature_Controller_Part_I_convo(val) { // Race condition: No youHold and no more chelsea_msgs // Need to hold until you generate topic content. chelsea_msgs.push("Good to meet you, " + val); + chelsea_msgs.push("Answer trivia questions to earn 🥝s."); + if (Temperature_Controller_Part_INumTopics > 1) { + chelsea_msgs.push("Pay 🥝s to play mini games."); + } + chelsea_msgs.push("Let's get started!"); topic = Temperature_Controller_Part_I_randint_topics(); Temperature_Controller_Part_I_convo(val); } else if (topic == Temperature_Controller_Part_ITriviaTopic) { diff --git a/src/example/templates/elena.js b/src/example/templates/elena.js index 103e9c8..c2e890d 100644 --- a/src/example/templates/elena.js +++ b/src/example/templates/elena.js @@ -56,6 +56,11 @@ function {{ module_name }}_convo(val) { // Race condition: No youHold and no more chelsea_msgs // Need to hold until you generate topic content. chelsea_msgs.push("Good to meet you, " + val); + chelsea_msgs.push("Answer trivia questions to earn 🥝s."); + if ({{ module_name }}NumTopics > 1) { + chelsea_msgs.push("Pay 🥝s to play mini games."); + } + chelsea_msgs.push("Let's get started!"); topic = {{ module_name }}_randint_topics(); {{ module_name }}_convo(val); } else if (topic == {{ module_name }}TriviaTopic) { From e0e4282620fd18eadf6455d7a211fad74ca2c6e8 Mon Sep 17 00:00:00 2001 From: thejackal360 Date: Fri, 8 Dec 2023 09:03:08 -0800 Subject: [PATCH 2/3] Make kiwis changeable --- src/elena/__init__.py | 2 +- src/elena/elena.py | 28 ++++++++++++-- src/elena/templates/elena.css | 2 +- src/elena/templates/elena.js | 34 ++++++++--------- src/elena/templates/elena_top.js | 36 +++++++++--------- src/elena/templates/index.html | 4 +- src/example/app.py | 2 +- src/example/static/css/elena.css | 2 +- src/example/static/js/elena_top.js | 36 +++++++++--------- .../js/games/Bacterial Culture_elena.js | 34 ++++++++--------- .../Temperature Controller Part II_elena.js | 34 ++++++++--------- .../Temperature Controller Part I_elena.js | 34 ++++++++--------- .../ml/__pycache__/__init__.cpython-310.pyc | Bin 167 -> 0 bytes .../ml/__pycache__/stylize.cpython-310.pyc | Bin 2529 -> 0 bytes .../__pycache__/transformer.cpython-310.pyc | Bin 4538 -> 0 bytes src/example/templates/elena.css | 2 +- src/example/templates/elena.js | 34 ++++++++--------- src/example/templates/elena_top.js | 36 +++++++++--------- src/example/templates/index.html | 4 +- 19 files changed, 172 insertions(+), 152 deletions(-) delete mode 100644 src/example/static/ml/__pycache__/__init__.cpython-310.pyc delete mode 100644 src/example/static/ml/__pycache__/stylize.cpython-310.pyc delete mode 100644 src/example/static/ml/__pycache__/transformer.cpython-310.pyc diff --git a/src/elena/__init__.py b/src/elena/__init__.py index 9466b43..6fd1afc 100644 --- a/src/elena/__init__.py +++ b/src/elena/__init__.py @@ -1,3 +1,3 @@ #!/usr/bin/env python3 -from .elena import eFlask, Module, Game +from .elena import eFlask, Module, Game, Point diff --git a/src/elena/elena.py b/src/elena/elena.py index ee44423..4d413c5 100644 --- a/src/elena/elena.py +++ b/src/elena/elena.py @@ -2,6 +2,7 @@ # Imports +from enum import Enum from flask import jsonify, Flask, Response, request, render_template from functools import partial from itertools import chain @@ -57,6 +58,19 @@ def dict_stitching(list_of_dicts): # Core classes +class Point(Enum): + KIWI = 1 + STRAWBERRY = 2 + CHERRY = 3 + + +PointToEmoji = { + Point.KIWI: "🥝", + Point.STRAWBERRY: "🍓", + Point.CHERRY: "🍒", +} + + class eFlask(Flask): """ Class used to instantiate app objects. @@ -66,25 +80,28 @@ def __init__( self, module_list, domain, - kiwi_cost_to_play_game=5, + point_cost_to_play_game=5, ask_for_game_every_N_rounds=3, bouncing_text=True, + point=Point.KIWI, **kwargs, ): """ Initializer. @param module_list: list of module objects for trivia game @param domain: website's domain - @param kiwi_cost_to_play_game: how many kiwis does it cost to play a game? default value is 5 + @param point_cost_to_play_game: how many points does it cost to play a game? default value is 5 @param ask_for_game_every_N_rounds: minimum number of rounds between games; default value is 3 @param bouncing_text: controls whether textboxes are animated to bounce up and down; default value is True """ super().__init__(**kwargs) self.module_list = module_list self.domain = domain - self.kiwi_cost_to_play_game = kiwi_cost_to_play_game + self.point_cost_to_play_game = point_cost_to_play_game self.ask_for_game_every_N_rounds = ask_for_game_every_N_rounds self.bouncing_text = bouncing_text + self.point = point + self.point_text = PointToEmoji[self.point] self.http_post_ptype_to_fn = dict_stitching( [m.http_post_ptype_to_fn for m in self.module_list] ) @@ -157,6 +174,7 @@ def gen_elenajs(self): elena_template.render( module_name=m.fn_module_name, module_name_in_quotes='"' + m.fn_module_name + '"', + point_text=self.point_text, ) ) @@ -167,8 +185,9 @@ def gen_elena_top_js(self): env = Environment(loader=FileSystemLoader(".")) template = env.get_template("templates/elena_top.js") rendered_content = template.render( - kiwi_cost_to_play_game=self.kiwi_cost_to_play_game, + point_cost_to_play_game=self.point_cost_to_play_game, ask_for_game_every_N_rounds=self.ask_for_game_every_N_rounds, + point_text=self.point_text, ) with open("static/js/elena_top.js", "w") as f: f.write(rendered_content) @@ -246,6 +265,7 @@ def handle_GET(self): module_js_globals=module_js_globals, module_subjs=module_subjs, pick_mod=pick_mod, + point_text=self.point_text, ) diff --git a/src/elena/templates/elena.css b/src/elena/templates/elena.css index 289a740..0e6734f 100644 --- a/src/elena/templates/elena.css +++ b/src/elena/templates/elena.css @@ -47,7 +47,7 @@ body { cursor: pointer; } -.kiwibar { +.pointbar { overflow: hidden; background-color: grey; position: fixed; diff --git a/src/elena/templates/elena.js b/src/elena/templates/elena.js index c2e890d..0a7ff97 100644 --- a/src/elena/templates/elena.js +++ b/src/elena/templates/elena.js @@ -1,12 +1,12 @@ /** -* Check whether chat topic is valid given (a) number of kiwis, +* Check whether chat topic is valid given (a) number of points, * or trivia points earned by the user for correct answers, and (b) * the number of rounds since the last game. * @param {BigInt} _t - topic index; limited by NumTopics constant * in generated *_globals.js file in static/js/games/ */ function {{ module_name }}_acceptable_topic(_t) { - if (((kiwicount_var >= kiwi_cost_to_play_game) && + if (((pointcount_var >= point_cost_to_play_game) && (rounds_since_last_game >= ask_for_game_every_N_rounds) && (_t != {{ module_name }}TriviaTopic)) || (_t == {{ module_name }}TriviaTopic)) { @@ -17,7 +17,7 @@ function {{ module_name }}_acceptable_topic(_t) { } /** -* Check whether chat topic is valid given (a) number of kiwis, +* Check whether chat topic is valid given (a) number of points, * or trivia points earned by the user for correct answers, and (b) * the number of rounds since the last game. * @param {BigInt} _t - topic index; limited by NumTopics constant @@ -56,20 +56,20 @@ function {{ module_name }}_convo(val) { // Race condition: No youHold and no more chelsea_msgs // Need to hold until you generate topic content. chelsea_msgs.push("Good to meet you, " + val); - chelsea_msgs.push("Answer trivia questions to earn 🥝s."); + chelsea_msgs.push("Answer trivia questions to earn {{ point_text }}s."); if ({{ module_name }}NumTopics > 1) { - chelsea_msgs.push("Pay 🥝s to play mini games."); + chelsea_msgs.push("Pay {{ point_text }}s to play mini games."); } chelsea_msgs.push("Let's get started!"); topic = {{ module_name }}_randint_topics(); {{ module_name }}_convo(val); } else if (topic == {{ module_name }}TriviaTopic) { if (question_asked) { - let kiwi_inc = false; + let point_inc = false; if (scrub_str(ans_txt) == scrub_str(val)) { chelsea_msgs.push("That is correct!"); - inc_kiwi_count(); - kiwi_inc = true; + inc_point_count(); + point_inc = true; } else { chelsea_msgs.push("Incorrect! The answer is: " + ans_txt @@ -77,7 +77,7 @@ function {{ module_name }}_convo(val) { } question_asked = false; topic = {{ module_name }}_randint_topics(); - if (!kiwi_inc) { + if (!point_inc) { {{ module_name }}_convo(val); } } else { @@ -143,18 +143,18 @@ function {{ module_name }}_start_game() { else bub.innerHTML += "."; } }, 1000); - var kiwi_inc_interval = window.setInterval(function() { + var point_inc_interval = window.setInterval(function() { if ((chelsea_msgs.length == 0) && - (kiwi_inc_waits > 0)) { - kiwicount_var += kiwi_inc_waits; - kiwi_inc_waits = 0; - $("#kiwicount").fadeOut(100).fadeIn(100).fadeOut(100). + (point_inc_waits > 0)) { + pointcount_var += point_inc_waits; + point_inc_waits = 0; + $("#pointcount").fadeOut(100).fadeIn(100).fadeOut(100). fadeIn(100).fadeOut(100). fadeIn(100).fadeOut(100). fadeIn(100).fadeOut(100). - html(kiwicount_var).fadeIn(100); - document.getElementById("kiwicount").innerHTML = - kiwicount_var; + html(pointcount_var).fadeIn(100); + document.getElementById("pointcount").innerHTML = + pointcount_var; youHold = false; {{ module_name }}_convo(null); newChelseaBubble(); diff --git a/src/elena/templates/elena_top.js b/src/elena/templates/elena_top.js index 998b971..738eeab 100644 --- a/src/elena/templates/elena_top.js +++ b/src/elena/templates/elena_top.js @@ -12,14 +12,14 @@ var question_sel = -1; var rounds_since_last_game = 0; var ans_txt = ""; -var kiwi_inc_waits = 0; -var kiwicount_var = 0; +var point_inc_waits = 0; +var pointcount_var = 0; var herready = false; var already_hit = false; var chelsea_msgs = ["Hi! I'm Chelsea. What's your name?"]; var convo_counter = 0; -const kiwi_cost_to_play_game = {{ kiwi_cost_to_play_game }}; +const point_cost_to_play_game = {{ point_cost_to_play_game }}; const ask_for_game_every_N_rounds = {{ ask_for_game_every_N_rounds }}; /** @@ -224,36 +224,36 @@ function start() { */ /** -* Pay kiwi_cost_to_play_game kiwis to play a game. +* Pay point_cost_to_play_game points to play a game. */ function pay_to_play() { - kiwicount_var -= kiwi_cost_to_play_game; - document.getElementById("kiwicount").innerHTML = kiwicount_var; + pointcount_var -= point_cost_to_play_game; + document.getElementById("pointcount").innerHTML = pointcount_var; } /** -* Increment someone's score by i kiwis, either through answering a +* Increment someone's score by i points, either through answering a * trivia question or through a bonus round. -* @param {BigInt} i - number of kiwis by which to increment the user's +* @param {BigInt} i - number of points by which to increment the user's * score. */ -function inc_kiwi_count(i = 1) { +function inc_point_count(i = 1) { // Wait for chelsea msg to be posted. youHold = true; if (i == 1) { - var kiwi_convo_idx = randint(3); - if (kiwi_convo_idx == 0) { - chelsea_msgs.push("Here's a kiwi. One less for me."); - } else if (kiwi_convo_idx == 1) { - chelsea_msgs.push("Have a kiwi."); + var point_convo_idx = randint(3); + if (point_convo_idx == 0) { + chelsea_msgs.push("Here's a {{ point_text }}. One less for me."); + } else if (point_convo_idx == 1) { + chelsea_msgs.push("Have a {{ point_text }}."); } else { - chelsea_msgs.push("I shall award you with one kiwi."); + chelsea_msgs.push("I shall award you with one {{ point_text }}."); } } else if (i > 0) { chelsea_msgs.push("Congrats! Here's a " + - i.toString() + " kiwi bonus!"); + i.toString() + " {{ point_text }} bonus!"); } - kiwi_inc_waits += i; + point_inc_waits += i; } /** @@ -301,7 +301,7 @@ function back_button_click() { $("#chat").animate({opacity: 0}, {duration: 3000}).promise().done(function() { $("#chat").hide(); document.getElementById("final_score").innerHTML = - "
Final score: " + kiwicount_var.toString() + "🥝"; + "
Final score: " + pointcount_var.toString() + "{{ point_text }}"; $("#final_score").animate({opacity: 1}, {duration: 3000}).promise().done(function() { $("#final_score").animate({opacity: 0}, {duration: 3000}).promise().done(function() { document.location.reload(); diff --git a/src/elena/templates/index.html b/src/elena/templates/index.html index 43231cd..5dc0c67 100644 --- a/src/elena/templates/index.html +++ b/src/elena/templates/index.html @@ -61,13 +61,13 @@ -
+
Arrow full left - Picol.org, CC BY 3.0 <https://creativecommons.org/licenses/by/3.0>, via Wikimedia Commons
-
🥝0
+
{{ point_text | safe }}0
diff --git a/src/example/app.py b/src/example/app.py index 6216413..dfaf8ea 100755 --- a/src/example/app.py +++ b/src/example/app.py @@ -13,7 +13,7 @@ from flask import jsonify, request, Response, send_from_directory from PIL import Image from static.ml.stylize import stylize -from elena import eFlask, Module, Game +from elena import eFlask, Module, Game, Point # Constants diff --git a/src/example/static/css/elena.css b/src/example/static/css/elena.css index a819703..10eb8a0 100644 --- a/src/example/static/css/elena.css +++ b/src/example/static/css/elena.css @@ -47,7 +47,7 @@ body { cursor: pointer; } -.kiwibar { +.pointbar { overflow: hidden; background-color: grey; position: fixed; diff --git a/src/example/static/js/elena_top.js b/src/example/static/js/elena_top.js index 0f12615..a9090e2 100644 --- a/src/example/static/js/elena_top.js +++ b/src/example/static/js/elena_top.js @@ -12,14 +12,14 @@ var question_sel = -1; var rounds_since_last_game = 0; var ans_txt = ""; -var kiwi_inc_waits = 0; -var kiwicount_var = 0; +var point_inc_waits = 0; +var pointcount_var = 0; var herready = false; var already_hit = false; var chelsea_msgs = ["Hi! I'm Chelsea. What's your name?"]; var convo_counter = 0; -const kiwi_cost_to_play_game = 5; +const point_cost_to_play_game = 5; const ask_for_game_every_N_rounds = 3; /** @@ -224,36 +224,36 @@ function start() { */ /** -* Pay kiwi_cost_to_play_game kiwis to play a game. +* Pay point_cost_to_play_game points to play a game. */ function pay_to_play() { - kiwicount_var -= kiwi_cost_to_play_game; - document.getElementById("kiwicount").innerHTML = kiwicount_var; + pointcount_var -= point_cost_to_play_game; + document.getElementById("pointcount").innerHTML = pointcount_var; } /** -* Increment someone's score by i kiwis, either through answering a +* Increment someone's score by i points, either through answering a * trivia question or through a bonus round. -* @param {BigInt} i - number of kiwis by which to increment the user's +* @param {BigInt} i - number of points by which to increment the user's * score. */ -function inc_kiwi_count(i = 1) { +function inc_point_count(i = 1) { // Wait for chelsea msg to be posted. youHold = true; if (i == 1) { - var kiwi_convo_idx = randint(3); - if (kiwi_convo_idx == 0) { - chelsea_msgs.push("Here's a kiwi. One less for me."); - } else if (kiwi_convo_idx == 1) { - chelsea_msgs.push("Have a kiwi."); + var point_convo_idx = randint(3); + if (point_convo_idx == 0) { + chelsea_msgs.push("Here's a 🍒. One less for me."); + } else if (point_convo_idx == 1) { + chelsea_msgs.push("Have a 🍒."); } else { - chelsea_msgs.push("I shall award you with one kiwi."); + chelsea_msgs.push("I shall award you with one 🍒."); } } else if (i > 0) { chelsea_msgs.push("Congrats! Here's a " + - i.toString() + " kiwi bonus!"); + i.toString() + " 🍒 bonus!"); } - kiwi_inc_waits += i; + point_inc_waits += i; } /** @@ -301,7 +301,7 @@ function back_button_click() { $("#chat").animate({opacity: 0}, {duration: 3000}).promise().done(function() { $("#chat").hide(); document.getElementById("final_score").innerHTML = - "
Final score: " + kiwicount_var.toString() + "🥝"; + "
Final score: " + pointcount_var.toString() + "🍒"; $("#final_score").animate({opacity: 1}, {duration: 3000}).promise().done(function() { $("#final_score").animate({opacity: 0}, {duration: 3000}).promise().done(function() { document.location.reload(); diff --git a/src/example/static/js/games/Bacterial Culture_elena.js b/src/example/static/js/games/Bacterial Culture_elena.js index 8c97adc..a8df238 100644 --- a/src/example/static/js/games/Bacterial Culture_elena.js +++ b/src/example/static/js/games/Bacterial Culture_elena.js @@ -1,12 +1,12 @@ /** -* Check whether chat topic is valid given (a) number of kiwis, +* Check whether chat topic is valid given (a) number of points, * or trivia points earned by the user for correct answers, and (b) * the number of rounds since the last game. * @param {BigInt} _t - topic index; limited by NumTopics constant * in generated *_globals.js file in static/js/games/ */ function Bacterial_Culture_acceptable_topic(_t) { - if (((kiwicount_var >= kiwi_cost_to_play_game) && + if (((pointcount_var >= point_cost_to_play_game) && (rounds_since_last_game >= ask_for_game_every_N_rounds) && (_t != Bacterial_CultureTriviaTopic)) || (_t == Bacterial_CultureTriviaTopic)) { @@ -17,7 +17,7 @@ function Bacterial_Culture_acceptable_topic(_t) { } /** -* Check whether chat topic is valid given (a) number of kiwis, +* Check whether chat topic is valid given (a) number of points, * or trivia points earned by the user for correct answers, and (b) * the number of rounds since the last game. * @param {BigInt} _t - topic index; limited by NumTopics constant @@ -56,20 +56,20 @@ function Bacterial_Culture_convo(val) { // Race condition: No youHold and no more chelsea_msgs // Need to hold until you generate topic content. chelsea_msgs.push("Good to meet you, " + val); - chelsea_msgs.push("Answer trivia questions to earn 🥝s."); + chelsea_msgs.push("Answer trivia questions to earn 🍒s."); if (Bacterial_CultureNumTopics > 1) { - chelsea_msgs.push("Pay 🥝s to play mini games."); + chelsea_msgs.push("Pay 🍒s to play mini games."); } chelsea_msgs.push("Let's get started!"); topic = Bacterial_Culture_randint_topics(); Bacterial_Culture_convo(val); } else if (topic == Bacterial_CultureTriviaTopic) { if (question_asked) { - let kiwi_inc = false; + let point_inc = false; if (scrub_str(ans_txt) == scrub_str(val)) { chelsea_msgs.push("That is correct!"); - inc_kiwi_count(); - kiwi_inc = true; + inc_point_count(); + point_inc = true; } else { chelsea_msgs.push("Incorrect! The answer is: " + ans_txt @@ -77,7 +77,7 @@ function Bacterial_Culture_convo(val) { } question_asked = false; topic = Bacterial_Culture_randint_topics(); - if (!kiwi_inc) { + if (!point_inc) { Bacterial_Culture_convo(val); } } else { @@ -143,18 +143,18 @@ function Bacterial_Culture_start_game() { else bub.innerHTML += "."; } }, 1000); - var kiwi_inc_interval = window.setInterval(function() { + var point_inc_interval = window.setInterval(function() { if ((chelsea_msgs.length == 0) && - (kiwi_inc_waits > 0)) { - kiwicount_var += kiwi_inc_waits; - kiwi_inc_waits = 0; - $("#kiwicount").fadeOut(100).fadeIn(100).fadeOut(100). + (point_inc_waits > 0)) { + pointcount_var += point_inc_waits; + point_inc_waits = 0; + $("#pointcount").fadeOut(100).fadeIn(100).fadeOut(100). fadeIn(100).fadeOut(100). fadeIn(100).fadeOut(100). fadeIn(100).fadeOut(100). - html(kiwicount_var).fadeIn(100); - document.getElementById("kiwicount").innerHTML = - kiwicount_var; + html(pointcount_var).fadeIn(100); + document.getElementById("pointcount").innerHTML = + pointcount_var; youHold = false; Bacterial_Culture_convo(null); newChelseaBubble(); diff --git a/src/example/static/js/games/Temperature Controller Part II_elena.js b/src/example/static/js/games/Temperature Controller Part II_elena.js index d55f359..7490db0 100644 --- a/src/example/static/js/games/Temperature Controller Part II_elena.js +++ b/src/example/static/js/games/Temperature Controller Part II_elena.js @@ -1,12 +1,12 @@ /** -* Check whether chat topic is valid given (a) number of kiwis, +* Check whether chat topic is valid given (a) number of points, * or trivia points earned by the user for correct answers, and (b) * the number of rounds since the last game. * @param {BigInt} _t - topic index; limited by NumTopics constant * in generated *_globals.js file in static/js/games/ */ function Temperature_Controller_Part_II_acceptable_topic(_t) { - if (((kiwicount_var >= kiwi_cost_to_play_game) && + if (((pointcount_var >= point_cost_to_play_game) && (rounds_since_last_game >= ask_for_game_every_N_rounds) && (_t != Temperature_Controller_Part_IITriviaTopic)) || (_t == Temperature_Controller_Part_IITriviaTopic)) { @@ -17,7 +17,7 @@ function Temperature_Controller_Part_II_acceptable_topic(_t) { } /** -* Check whether chat topic is valid given (a) number of kiwis, +* Check whether chat topic is valid given (a) number of points, * or trivia points earned by the user for correct answers, and (b) * the number of rounds since the last game. * @param {BigInt} _t - topic index; limited by NumTopics constant @@ -56,20 +56,20 @@ function Temperature_Controller_Part_II_convo(val) { // Race condition: No youHold and no more chelsea_msgs // Need to hold until you generate topic content. chelsea_msgs.push("Good to meet you, " + val); - chelsea_msgs.push("Answer trivia questions to earn 🥝s."); + chelsea_msgs.push("Answer trivia questions to earn 🍒s."); if (Temperature_Controller_Part_IINumTopics > 1) { - chelsea_msgs.push("Pay 🥝s to play mini games."); + chelsea_msgs.push("Pay 🍒s to play mini games."); } chelsea_msgs.push("Let's get started!"); topic = Temperature_Controller_Part_II_randint_topics(); Temperature_Controller_Part_II_convo(val); } else if (topic == Temperature_Controller_Part_IITriviaTopic) { if (question_asked) { - let kiwi_inc = false; + let point_inc = false; if (scrub_str(ans_txt) == scrub_str(val)) { chelsea_msgs.push("That is correct!"); - inc_kiwi_count(); - kiwi_inc = true; + inc_point_count(); + point_inc = true; } else { chelsea_msgs.push("Incorrect! The answer is: " + ans_txt @@ -77,7 +77,7 @@ function Temperature_Controller_Part_II_convo(val) { } question_asked = false; topic = Temperature_Controller_Part_II_randint_topics(); - if (!kiwi_inc) { + if (!point_inc) { Temperature_Controller_Part_II_convo(val); } } else { @@ -143,18 +143,18 @@ function Temperature_Controller_Part_II_start_game() { else bub.innerHTML += "."; } }, 1000); - var kiwi_inc_interval = window.setInterval(function() { + var point_inc_interval = window.setInterval(function() { if ((chelsea_msgs.length == 0) && - (kiwi_inc_waits > 0)) { - kiwicount_var += kiwi_inc_waits; - kiwi_inc_waits = 0; - $("#kiwicount").fadeOut(100).fadeIn(100).fadeOut(100). + (point_inc_waits > 0)) { + pointcount_var += point_inc_waits; + point_inc_waits = 0; + $("#pointcount").fadeOut(100).fadeIn(100).fadeOut(100). fadeIn(100).fadeOut(100). fadeIn(100).fadeOut(100). fadeIn(100).fadeOut(100). - html(kiwicount_var).fadeIn(100); - document.getElementById("kiwicount").innerHTML = - kiwicount_var; + html(pointcount_var).fadeIn(100); + document.getElementById("pointcount").innerHTML = + pointcount_var; youHold = false; Temperature_Controller_Part_II_convo(null); newChelseaBubble(); diff --git a/src/example/static/js/games/Temperature Controller Part I_elena.js b/src/example/static/js/games/Temperature Controller Part I_elena.js index bc3b7d4..f0c9d12 100644 --- a/src/example/static/js/games/Temperature Controller Part I_elena.js +++ b/src/example/static/js/games/Temperature Controller Part I_elena.js @@ -1,12 +1,12 @@ /** -* Check whether chat topic is valid given (a) number of kiwis, +* Check whether chat topic is valid given (a) number of points, * or trivia points earned by the user for correct answers, and (b) * the number of rounds since the last game. * @param {BigInt} _t - topic index; limited by NumTopics constant * in generated *_globals.js file in static/js/games/ */ function Temperature_Controller_Part_I_acceptable_topic(_t) { - if (((kiwicount_var >= kiwi_cost_to_play_game) && + if (((pointcount_var >= point_cost_to_play_game) && (rounds_since_last_game >= ask_for_game_every_N_rounds) && (_t != Temperature_Controller_Part_ITriviaTopic)) || (_t == Temperature_Controller_Part_ITriviaTopic)) { @@ -17,7 +17,7 @@ function Temperature_Controller_Part_I_acceptable_topic(_t) { } /** -* Check whether chat topic is valid given (a) number of kiwis, +* Check whether chat topic is valid given (a) number of points, * or trivia points earned by the user for correct answers, and (b) * the number of rounds since the last game. * @param {BigInt} _t - topic index; limited by NumTopics constant @@ -56,20 +56,20 @@ function Temperature_Controller_Part_I_convo(val) { // Race condition: No youHold and no more chelsea_msgs // Need to hold until you generate topic content. chelsea_msgs.push("Good to meet you, " + val); - chelsea_msgs.push("Answer trivia questions to earn 🥝s."); + chelsea_msgs.push("Answer trivia questions to earn 🍒s."); if (Temperature_Controller_Part_INumTopics > 1) { - chelsea_msgs.push("Pay 🥝s to play mini games."); + chelsea_msgs.push("Pay 🍒s to play mini games."); } chelsea_msgs.push("Let's get started!"); topic = Temperature_Controller_Part_I_randint_topics(); Temperature_Controller_Part_I_convo(val); } else if (topic == Temperature_Controller_Part_ITriviaTopic) { if (question_asked) { - let kiwi_inc = false; + let point_inc = false; if (scrub_str(ans_txt) == scrub_str(val)) { chelsea_msgs.push("That is correct!"); - inc_kiwi_count(); - kiwi_inc = true; + inc_point_count(); + point_inc = true; } else { chelsea_msgs.push("Incorrect! The answer is: " + ans_txt @@ -77,7 +77,7 @@ function Temperature_Controller_Part_I_convo(val) { } question_asked = false; topic = Temperature_Controller_Part_I_randint_topics(); - if (!kiwi_inc) { + if (!point_inc) { Temperature_Controller_Part_I_convo(val); } } else { @@ -143,18 +143,18 @@ function Temperature_Controller_Part_I_start_game() { else bub.innerHTML += "."; } }, 1000); - var kiwi_inc_interval = window.setInterval(function() { + var point_inc_interval = window.setInterval(function() { if ((chelsea_msgs.length == 0) && - (kiwi_inc_waits > 0)) { - kiwicount_var += kiwi_inc_waits; - kiwi_inc_waits = 0; - $("#kiwicount").fadeOut(100).fadeIn(100).fadeOut(100). + (point_inc_waits > 0)) { + pointcount_var += point_inc_waits; + point_inc_waits = 0; + $("#pointcount").fadeOut(100).fadeIn(100).fadeOut(100). fadeIn(100).fadeOut(100). fadeIn(100).fadeOut(100). fadeIn(100).fadeOut(100). - html(kiwicount_var).fadeIn(100); - document.getElementById("kiwicount").innerHTML = - kiwicount_var; + html(pointcount_var).fadeIn(100); + document.getElementById("pointcount").innerHTML = + pointcount_var; youHold = false; Temperature_Controller_Part_I_convo(null); newChelseaBubble(); diff --git a/src/example/static/ml/__pycache__/__init__.cpython-310.pyc b/src/example/static/ml/__pycache__/__init__.cpython-310.pyc deleted file mode 100644 index 249c15978e9dfde1696579d3a915d97aaef239a8..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 167 zcmd1j<>g`kg8SxCsUZ3>h(HF6K#l_t7qb9~6oz01O-8?!3`HPe1o6vDKO;XkRlg)7 zH7hYWJ26MUD77HJSl=}#H7`-uJux>`*EKIaGcVOxzqlw_KeZw;w;(4~zqll^Br{n* kH%C7{J~J<~BtBlRpz;=nO>TZlX-=vg$c|zrAi=@_0KAeY6951J diff --git a/src/example/static/ml/__pycache__/stylize.cpython-310.pyc b/src/example/static/ml/__pycache__/stylize.cpython-310.pyc deleted file mode 100644 index 7b692dcaf74facf5fbfe5ce28e557bbefea65bd9..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 2529 zcmZ`)-ESN<5VyS_x3{?@*Ce79h0>z7^h%opf`kN7Kq^(Kr~)F9Dk9LzT|0N1?8nu+ zm*!4;Pl?p@p+fK%An*vyTnRSJ3he5P}FAlQklkuwt69HAY7^Yt4o+J9ZLx%>~ zs%2Tc$kZlS{o>e~hYbD4j|<-_Gz(h(8;Ct7NSCPDg6vahY)C*_f(o`vhP1_obimTP zCE2ilvR;u_bYKv6N4C9+wxM?8`DAEvD+l?%;Wg-yB5lTIv~dBKY) zY$h@EdU4d3^PQgd7Gs_~6MU(TDIlCa>Aw{fSuwvDXCaUCCFqP?&ZUm76=<{2@;e|} zko?c}0bo+lJ+?y&hUm4Rca@ZM4)FMuJ!dPUB{VE;MQNd(^*G}NtdMUvm}c`IsR;;m zU}^e|rcbp8_8^B;&AQbjjA?%{j`AYRlFrf`&W&Yv38UAK`d8k}``GbZ=4U}y4*ab! zgz`{e4MuYz&}Kpf2ZX$h+BAys*0e;FG^z>@imp6>WU^dpZ#7$$X`U(VJ~5DKCvWqP z)K1Zb3TS^d`~LBh#|dvq?fxKfVY=E)^XFYD`?BEzCP_LF6w!D9 zEx!!{_u`NY@Jom0_zY-CM+Zn)Lkl(7()O~#Uk_1?(6M!8yd-UfovwD$ZUS4aYR)YJ z)nE!IQ17EKK%bzk?V`vc9L=#Ho?By6nC^X0&ZUcW!2M^^#r=n;vqTAJZ%D70vyQz} z%T>_eVA17J#{Arz_G(p5q{s zGmM$6Y{;=78x)yGRRm3ec?LkD1FNLM1`@2N_n_xM@3L?QR(cDx3TW4a2ii5zs-WEx zK4_Ogn*i;esDV}oZ4$HvF$G!`v}w>j7j@8>xCBgQ?T~?8+WWv-8%}8f3a$Xg6Em+t zQUW8D5*ZL#%^Q+mZqQM#)gghNkNh?Ea7w#$fX&=uqICCbLu9tfQ@8?bcy}!Do-8Xn zfb7R4@4bN7`2L7d#`ebSvbMvn;OZ_w)4x7{hKf$PylK#!?-XsdfauyW@AvxeUEqv^ z=&Ri%%Xt*`Z(QIw8b;T?x5d-zkFr+#LT8{zrABe>7ko=zI6V%U>8sCpkEc<1z+}!q!_$*tmI5mkfuSj2Jh)t>`VuFbGyUMC#zBWe#jI2odg}PE5uxdNOQupm zRw5W%rcW&<@|#3a8Q)@fcjikVW-Oa|lo_H!vU{@u30gi_y(6E&OQ)beMg4y~r~bF+ zsBbZ2F9;GIr9sfIn@RH~kLC9KMn|>~S*T5es)yjI=0QLow`!xNzQCU+P8KSaL0f%@ zp3Tu1mSro-p-Se~I0e)Ic`|(p*LM({S?nn_dW%UWy0KhB?#r)$@CdLxFum`1?|2R7 M_($HYI<=4f1O7>b7ytkO diff --git a/src/example/static/ml/__pycache__/transformer.cpython-310.pyc b/src/example/static/ml/__pycache__/transformer.cpython-310.pyc deleted file mode 100644 index e17d7fd4d9867e51023a8ea7824408bf6e2cff36..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 4538 zcmb_fOLN=S6~>z&CDDqkD2dZ1Xp+`tQ;~jDiQ}fJVkh-v#?iF4yWw<-Ai$*v2?Ur6 z(6%)2OlRzwti0{oTI!E<(Vu`#7F}uGowG>4a{v;QOs8EGoO^ihIroKgzw@1oWM!qL z;Q8*uzSvq*lz&lU{xQ(lMoGsIffA^Z(l7tjk=EB#<(3j?f&N4ZbfN9(kM+I*jS-m8 zn8HBYMB54)Xg8`J7BqIygr-?(8qlv$=f%U8gGY*ikRtZQb!V7moClc>IeLcU7>0g)-0nk$dBXWEgXDw+Pw$jpGf z6&Q~Vw5=lr8Z98LHK#Fy#=Pdp$`!Z4<887$*0TTde`I1rlSi~Lg6GGYX0>Ju8k`Ux%ib^a(8?n+juc@M%smFtA@I)TC-w3 zH*8y-{;cnfMjKWtt7_}}!#8KBpG8G?>LQ;!HhswNRBocA??B|rGbLA#)JFi;Gj&$e zxTfXWUFBHa>FDx2`pQ>HyasWs%h&N&s1FMrQ6=9b1B;)Kx={rqEs)v}EtP(TdU#>M zMyt-p4La5se#5c0Tz8ZNlZfieuKNuRt+F&+H%NTfWq-+^(Q+%*srVv_V5m3q2CR~H z#Hb-67{V|C;?gzc7&u|f#zcmIrx!U)PZv{%m?#n>M3N^DoROCaiIC!D zXccT;ptHoe_}Et9$$cT6aOCZx<;4M+?uP*yQe-l5i0Q(3*AasO_>!l&^CIc~->CEC z?>MwmU?APR#}#IaYLL#7$Jqe+y7 z<0ureqj50G_o*{Oein&5X%G5z9Rj4H)wE%$*7KHq`1WGJE~XFiD7_Yyly+Eqln5hN z_Vjfyy!@cR>?+c%fdHN6nsLh_b zk4o(+%H6phs27w+7G>1jBG0*;OMxXV*K^~@pbVW;*0posabJ_~XZl_<$4xCTo@!IX z!Dhnt5o}9mZG^~UYo~Bt zTnUOcZcCNI9eY7xQI>_iMH$nLINdfWPrKQ{SQPCqDwpg)Mcvp`c3ZkZ3zr7CkkiOg z7`y(^i(?U`#WHxRZY_ahpmx*nP!v|0Nf3-&#&(NkY$O1`u<0z6D4BkWQsLg#men=g z(rtAeNpxK`emGp4T@)5WeG2oNG|O)w7H7&mTzhZ;=X3QDXG`?b=W?gE!_kgdxPmDp z%_Fx+d`RLg5;bx;Q&AB72_>ahnC4AGZ~cJm`AWU#Y0^|Bo$RqC-^HJNkHpVO&}hz% z@*>shMe3YLhrW%H5>9Qf!|Ey{+DG%$Gs}p-f_fGlxT^;?2MB#DAS0IF2y@x6DT#Fs z|H9P&nGj=VdI5883s1(B9Pl2_7nDL^^OId%>HxY{nR6Cj%eO9H>0Y{e_1YG9D*2WU z%O^2?s6Gq7Z8T1YUxqWHP{Wl~drF~(i!@!HDd=9X*-Y*F4%0YD=VMIQX_kRQFIf7T zS=yv{xGb5)iMtC!ifB@>`U-AQjCOkpb@^KweTD?-;J!j((rT+~xHo|cH>RHBtLtLK z(lJqfxk;nxs2G!UzpHL`xaH}ngJ8I(=h|xuH2RdVb$J7$B*l%SNq}0~uq3W7Yy=*z z*x7+}NLK@DhS~x2DdjeUE~SVwAokVM`<^nlRv+8T>6?7pr#UHy(w(hsu38K!ABt1Y z6ru9hP=i%Cc~W5b#KY64oTuXC7~0dIs5qIwi>5rBgM&HCn>l?mS-Hhrd=Y%xnB!Z9 z2yDc~TW5HhZ3H3N#gd&?2^`)b2PuK2I7gAq=? z2y)dY#h%La*q)=uxlarE3C18SZsG5Lpv9b4Anq?eCMr@qKfl8YVDk4g<2H#Js5SGE z^G7H(^R*c=on~QX3BK?PoBz6T%&}ZpU-HKYe=zU`f{Bu`SYoYSg=-WOh5d2)3G<0c VOVL@|3eu3a`rg{>YZo@o{|7`#{9gb7 diff --git a/src/example/templates/elena.css b/src/example/templates/elena.css index 289a740..0e6734f 100644 --- a/src/example/templates/elena.css +++ b/src/example/templates/elena.css @@ -47,7 +47,7 @@ body { cursor: pointer; } -.kiwibar { +.pointbar { overflow: hidden; background-color: grey; position: fixed; diff --git a/src/example/templates/elena.js b/src/example/templates/elena.js index c2e890d..0a7ff97 100644 --- a/src/example/templates/elena.js +++ b/src/example/templates/elena.js @@ -1,12 +1,12 @@ /** -* Check whether chat topic is valid given (a) number of kiwis, +* Check whether chat topic is valid given (a) number of points, * or trivia points earned by the user for correct answers, and (b) * the number of rounds since the last game. * @param {BigInt} _t - topic index; limited by NumTopics constant * in generated *_globals.js file in static/js/games/ */ function {{ module_name }}_acceptable_topic(_t) { - if (((kiwicount_var >= kiwi_cost_to_play_game) && + if (((pointcount_var >= point_cost_to_play_game) && (rounds_since_last_game >= ask_for_game_every_N_rounds) && (_t != {{ module_name }}TriviaTopic)) || (_t == {{ module_name }}TriviaTopic)) { @@ -17,7 +17,7 @@ function {{ module_name }}_acceptable_topic(_t) { } /** -* Check whether chat topic is valid given (a) number of kiwis, +* Check whether chat topic is valid given (a) number of points, * or trivia points earned by the user for correct answers, and (b) * the number of rounds since the last game. * @param {BigInt} _t - topic index; limited by NumTopics constant @@ -56,20 +56,20 @@ function {{ module_name }}_convo(val) { // Race condition: No youHold and no more chelsea_msgs // Need to hold until you generate topic content. chelsea_msgs.push("Good to meet you, " + val); - chelsea_msgs.push("Answer trivia questions to earn 🥝s."); + chelsea_msgs.push("Answer trivia questions to earn {{ point_text }}s."); if ({{ module_name }}NumTopics > 1) { - chelsea_msgs.push("Pay 🥝s to play mini games."); + chelsea_msgs.push("Pay {{ point_text }}s to play mini games."); } chelsea_msgs.push("Let's get started!"); topic = {{ module_name }}_randint_topics(); {{ module_name }}_convo(val); } else if (topic == {{ module_name }}TriviaTopic) { if (question_asked) { - let kiwi_inc = false; + let point_inc = false; if (scrub_str(ans_txt) == scrub_str(val)) { chelsea_msgs.push("That is correct!"); - inc_kiwi_count(); - kiwi_inc = true; + inc_point_count(); + point_inc = true; } else { chelsea_msgs.push("Incorrect! The answer is: " + ans_txt @@ -77,7 +77,7 @@ function {{ module_name }}_convo(val) { } question_asked = false; topic = {{ module_name }}_randint_topics(); - if (!kiwi_inc) { + if (!point_inc) { {{ module_name }}_convo(val); } } else { @@ -143,18 +143,18 @@ function {{ module_name }}_start_game() { else bub.innerHTML += "."; } }, 1000); - var kiwi_inc_interval = window.setInterval(function() { + var point_inc_interval = window.setInterval(function() { if ((chelsea_msgs.length == 0) && - (kiwi_inc_waits > 0)) { - kiwicount_var += kiwi_inc_waits; - kiwi_inc_waits = 0; - $("#kiwicount").fadeOut(100).fadeIn(100).fadeOut(100). + (point_inc_waits > 0)) { + pointcount_var += point_inc_waits; + point_inc_waits = 0; + $("#pointcount").fadeOut(100).fadeIn(100).fadeOut(100). fadeIn(100).fadeOut(100). fadeIn(100).fadeOut(100). fadeIn(100).fadeOut(100). - html(kiwicount_var).fadeIn(100); - document.getElementById("kiwicount").innerHTML = - kiwicount_var; + html(pointcount_var).fadeIn(100); + document.getElementById("pointcount").innerHTML = + pointcount_var; youHold = false; {{ module_name }}_convo(null); newChelseaBubble(); diff --git a/src/example/templates/elena_top.js b/src/example/templates/elena_top.js index 998b971..738eeab 100644 --- a/src/example/templates/elena_top.js +++ b/src/example/templates/elena_top.js @@ -12,14 +12,14 @@ var question_sel = -1; var rounds_since_last_game = 0; var ans_txt = ""; -var kiwi_inc_waits = 0; -var kiwicount_var = 0; +var point_inc_waits = 0; +var pointcount_var = 0; var herready = false; var already_hit = false; var chelsea_msgs = ["Hi! I'm Chelsea. What's your name?"]; var convo_counter = 0; -const kiwi_cost_to_play_game = {{ kiwi_cost_to_play_game }}; +const point_cost_to_play_game = {{ point_cost_to_play_game }}; const ask_for_game_every_N_rounds = {{ ask_for_game_every_N_rounds }}; /** @@ -224,36 +224,36 @@ function start() { */ /** -* Pay kiwi_cost_to_play_game kiwis to play a game. +* Pay point_cost_to_play_game points to play a game. */ function pay_to_play() { - kiwicount_var -= kiwi_cost_to_play_game; - document.getElementById("kiwicount").innerHTML = kiwicount_var; + pointcount_var -= point_cost_to_play_game; + document.getElementById("pointcount").innerHTML = pointcount_var; } /** -* Increment someone's score by i kiwis, either through answering a +* Increment someone's score by i points, either through answering a * trivia question or through a bonus round. -* @param {BigInt} i - number of kiwis by which to increment the user's +* @param {BigInt} i - number of points by which to increment the user's * score. */ -function inc_kiwi_count(i = 1) { +function inc_point_count(i = 1) { // Wait for chelsea msg to be posted. youHold = true; if (i == 1) { - var kiwi_convo_idx = randint(3); - if (kiwi_convo_idx == 0) { - chelsea_msgs.push("Here's a kiwi. One less for me."); - } else if (kiwi_convo_idx == 1) { - chelsea_msgs.push("Have a kiwi."); + var point_convo_idx = randint(3); + if (point_convo_idx == 0) { + chelsea_msgs.push("Here's a {{ point_text }}. One less for me."); + } else if (point_convo_idx == 1) { + chelsea_msgs.push("Have a {{ point_text }}."); } else { - chelsea_msgs.push("I shall award you with one kiwi."); + chelsea_msgs.push("I shall award you with one {{ point_text }}."); } } else if (i > 0) { chelsea_msgs.push("Congrats! Here's a " + - i.toString() + " kiwi bonus!"); + i.toString() + " {{ point_text }} bonus!"); } - kiwi_inc_waits += i; + point_inc_waits += i; } /** @@ -301,7 +301,7 @@ function back_button_click() { $("#chat").animate({opacity: 0}, {duration: 3000}).promise().done(function() { $("#chat").hide(); document.getElementById("final_score").innerHTML = - "
Final score: " + kiwicount_var.toString() + "🥝"; + "
Final score: " + pointcount_var.toString() + "{{ point_text }}"; $("#final_score").animate({opacity: 1}, {duration: 3000}).promise().done(function() { $("#final_score").animate({opacity: 0}, {duration: 3000}).promise().done(function() { document.location.reload(); diff --git a/src/example/templates/index.html b/src/example/templates/index.html index 43231cd..5dc0c67 100644 --- a/src/example/templates/index.html +++ b/src/example/templates/index.html @@ -61,13 +61,13 @@
-
+
Arrow full left - Picol.org, CC BY 3.0 <https://creativecommons.org/licenses/by/3.0>, via Wikimedia Commons
-
🥝0
+
{{ point_text | safe }}0
From efabe8799404adeca7c87a6fc4847d46b261cae1 Mon Sep 17 00:00:00 2001 From: thejackal360 Date: Fri, 8 Dec 2023 09:05:29 -0800 Subject: [PATCH 3/3] Document point feature --- src/elena/elena.py | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/src/elena/elena.py b/src/elena/elena.py index 4d413c5..cd8ed95 100644 --- a/src/elena/elena.py +++ b/src/elena/elena.py @@ -11,6 +11,7 @@ import json import random import sys +from typing import Dict # https://github.com/pallets/flask/blob/main/src/flask/scaffold.py#L36 import typing as t @@ -59,12 +60,23 @@ def dict_stitching(list_of_dicts): class Point(Enum): + """ + Enumeration representing different types of points + """ + KIWI = 1 STRAWBERRY = 2 CHERRY = 3 -PointToEmoji = { +""" +A dictionary mapping Point enum values to corresponding emoji representations. + +This dictionary is used to associate each Point type with its corresponding +Unicode emoji representation. It allows for easy conversion between Point +types and the emojis used to visually represent them. +""" +PointToEmoji: Dict[Point, str] = { Point.KIWI: "🥝", Point.STRAWBERRY: "🍓", Point.CHERRY: "🍒",