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
/**
* Approach:
* - Use an HTTP val to serve the HTML page.
* - HTML will be designed for a Wordle game.
* - CSS will include fun gradients, crazy fonts, and colors.
* - JavaScript will handle the game logic for Wordle.
*/
export default async function(req: Request): Promise<Response> {
const htmlContent = `
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Crazy Wordle</title>
<link href="https://fonts.googleapis.com/css?family=Creepster|Permanent+Marker&display=swap" rel="stylesheet">
<style>
body {
background: linear-gradient(135deg, #f093fb, #f5576c);
font-family: 'Permanent Marker', cursive;
display: flex;
justify-content: center;
align-items: center;
height: 100vh;
color: white;
}
#game-container {
text-align: center;
}
.row {
display: flex;
justify-content: center;
margin: 5px;
}
.cell {
width: 50px;
height: 50px;
margin: 2px;
border: 2px solid white;
display: flex;
justify-content: center;
align-items: center;
font-size: 2em;
font-family: 'Creepster', cursive;
background-color: black;
}
.green {
background-color: green;
}
.yellow {
background-color: yellow;
color: black;
}
.gray {
background-color: gray;
}
#message {
font-size: 1.5em;
margin-top: 20px;
}
</style>
</head>
<body>
<div id="game-container">
<h1>Crazy Wordle</h1>
<div id="board">
<div class="row">
<div class="cell" id="cell-0-0"></div>
<div class="cell" id="cell-0-1"></div>
<div class="cell" id="cell-0-2"></div>
<div class="cell" id="cell-0-3"></div>
<div class="cell" id="cell-0-4"></div>
</div>
<!-- Additional rows here... -->
</div>
<div id="message"></div>
<button onclick="restartGame()">Restart</button>
</div>
<script>
const word = "CRAZY"; // Change this to any word you'd like
let currentRow = 0;
let currentCol = 0;
document.addEventListener('keydown', handleKeydown);
function handleKeydown(event) {
const key = event.key.toUpperCase();
if (key >= 'A' && key <= 'Z' && currentCol < 5) {
document.getElementById(\`cell-\${currentRow}-\${currentCol}\`).innerText = key;
currentCol++;
} else if (key === 'BACKSPACE' && currentCol > 0) {
currentCol--;
document.getElementById(\`cell-\${currentRow}-\${currentCol}\`).innerText = '';
} else if (key === 'ENTER' && currentCol === 5) {
checkGuess();
}
}
function checkGuess() {