-
Notifications
You must be signed in to change notification settings - Fork 0
/
bingo.html
160 lines (159 loc) · 3.94 KB
/
bingo.html
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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
<html>
<head>
<script type="text/javascript" src="scripts/jquery-1.4.2.js"></script>
<script type="text/javascript">
var Board = (function() {
var SQUARES = [
[
"Alcohol",
"Athletic Paraphernalia",
"Bandana",
"Boobies",
"Bunny",
"Cat",
"Creepy Old Guy",
"Dancing",
"Desperation",
"Dog",
"Eating",
"Hamster",
"Handwritten Sign",
"Hipster",
"Instrument",
"Mask",
"Military",
"Piercing",
"Sandwich",
"Sports",
"Stuffed Animal",
"Tattoo",
"Toilet",
"Torso"
],
[
"10+ people",
"30-second conversation",
"Air Guitar",
"Back-to-back Female Chatters",
"Chat Roulette Bingo Playing Crowd",
"Green Man",
"Blown Kiss",
"Midget",
"Excellent Mustache",
"Octogenarian",
"Robot",
"Thumbs Up",
"Twins",
"Your Doppelganger"
],
[
"Blake Commagere",
"Guy Fawkes",
"Macarena",
"Piano Improv",
"Rick Astley",
"Swastika"
]
]
var SQUARE_WEIGHTINGS = [0, 0, 0, 0, 0, 0, 1, 1, 1, 2]
var BOARD_WIDTH = 5;
var BOARD_HEIGHT = 5;
var setup = function() {
for (var i = 0; i < BOARD_WIDTH; i++) {
for (var j = 0; j < BOARD_HEIGHT; j++) {
if (!isCenter(i, j)) {
var rarity =
SQUARE_WEIGHTINGS[randomInteger(SQUARE_WEIGHTINGS.length)];
var val = SQUARES[rarity][randomInteger(SQUARES[rarity].length)];
SQUARES[rarity] = removeAll(SQUARES[rarity], val);
if (val.length > 18) {
setFont(i, j, 18);
}
setSquare(i, j, val);
}
}
}
};
var removeAll = function(arr, val) {
return arr.filter(function(elem) {
return elem != val;
});
};
var setFont = function(i, j, fontSize) {
$("#board_squares tr:eq(" + i + ") td:eq(" + j + ")").
attr("style", "font-size: " + fontSize + "px");
}
var setSquare = function(i, j, val) {
var square =
$("#board_squares tr:eq(" + i + ") td:eq(" + j + ")");
square.html(val);
};
var randomInteger = function(n) {
return Math.floor(Math.random() * n);
};
var isCenter = function(i, j) {
return (i == Math.floor(BOARD_HEIGHT / 2)) &&
(j == Math.floor(BOARD_WIDTH / 2));
};
return {
setup: setup
}
})();
$(function() {
Board.setup();
})
</script>
<style type="text/css">
body {
font-family: "League Gothic", Helvetica;
padding: 20px;
text-transform: uppercase;
}
body, th {
font-size: 32px;
}
h1 {
font-size: 48px;
font-weight: normal;
margin: 0 40px;
padding: 0;
}
table {
margin: 0 auto 20px;
}
td, th {
background: #fff;
border: 1px solid #ddd;
font-size: 22px;
height: 100px;
padding: 5px;
text-align: center;
width: 90px;
}
td.wildcard {
background: #111;
color: #eee;
font-size: 40px;
}
#board {
padding: 20px 0;
margin: 0 auto;
width: 600px;
}
</style>
</head>
<body>
<div id="board">
<h1>Chat Roulette Bingo</h1>
<table id="board_squares">
<tr><td></td><td></td><td></td><td></td><td></td></tr>
<tr><td></td><td></td><td></td><td></td><td></td></tr>
<tr><td></td><td></td>
<td class="wildcard">PENIS</td><td></td><td></td>
</tr>
<tr><td></td><td></td><td></td><td></td><td></td></tr>
<tr><td></td><td></td><td></td><td></td><td></td></tr>
</table>
</div>
</body>
</html>