summaryrefslogtreecommitdiff
path: root/js/course.js
blob: f422e6d2878f6b69cfae949ea70c4405e4a4b7eb (plain)
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
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(n){
	var pcount = n || rand(2) + 1;
	var ps = [];
	while (pcount-- > 0) ps.push(product());
	if (rand(100) < 90) {
		var d = ps.join(" and ") + " " + choice(preparations);
	}
	else {
		var d = ps.join(", ");
	}
	return d;
}
function product(){
	var result;
	if (rand(100) > 99) {
		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;
}