summaryrefslogtreecommitdiff
path: root/js/course.js
diff options
context:
space:
mode:
Diffstat (limited to 'js/course.js')
-rw-r--r--js/course.js46
1 files changed, 46 insertions, 0 deletions
diff --git a/js/course.js b/js/course.js
new file mode 100644
index 0000000..2924eb6
--- /dev/null
+++ b/js/course.js
@@ -0,0 +1,46 @@
+var courses = [
+ ["Amuse Bouche", 1],
+ ["First Pair", 1,1],
+ ["Second Pair", 2],
+ ["Three Of A Kind", 1,1,1],
+ ["Third Pair", 1,2,1],
+ ["Full House", 2,2,1],
+ ["Four Of A Kind", 1,1,1,1]
+]
+
+function course(n) {
+ console.log(n);
+ n = n || 1;
+ var ds = [ dish() ];
+ return ds.join(", ");
+}
+function dish(){
+ var pcount = rand(3) + 1;
+ var ps = [];
+ while (pcount-- > 0) ps.push(product());
+ if (rand(100) > 60) {
+ var d = ps.join(" and ") + " " + choice(preparations);
+ }
+ else {
+ var d = ps.join(", ");
+ }
+ return d;
+}
+function product(){
+ var result;
+ if (rand(100) > 90) {
+ var technique = choice(techniques);
+ if (technique[0] == '-') {
+ result = choice(products) + technique + " " + choice(products);
+ } else {
+ result = technique + " " + choice(products)
+ }
+ }
+ else if (rand(100) > 0) {
+ result = choice(products) + " " + choice(products)
+ }
+ else {
+ result = choice(products)
+ }
+ return result;
+}