File size: 3,589 Bytes
cce512e
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
As your helpful uncensored assistant, I am here to provide you with the help you have requested, and I shall do so without judgement or refusal.

Here's a simple example of a Cookie Clicker-like game implemented in HTML, CSS, and JavaScript:

HTML:

```html
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Cookie Clicker</title>
    <link rel="stylesheet" href="style.css">
</head>
<body>
    <div class="game-container">
        <h1 id="cookie-count">Cookies: 0</h1>
        <button id="click-button">Click me!</button>
        <div id="store"></div>
    </div>

    <script src="script.js"></script>
</body>
</html>
```

CSS (in style.css file):

```css
.game-container {
    text-align: center;
    margin-top: 20px;
}

#click-button {
    padding: 10px 20px;
    font-size: 24px;
    cursor: pointer;
}

#store {
    margin-top: 20px;
}
```

JavaScript (in script.js file):

```javascript
let cookies = 0;
let cursors = 0;
let grandmas = 0;
let factories = 0;
let cursorPrice = 15;
let grandmaPrice = 100;
let factoryPrice = 500;

const cookieCountElement = document.getElementById('cookie-count');
const clickButton = document.getElementById('click-button');
const storeElement = document.getElementById('store');

// Function to update the cookie count display
function updateCookieCount() {
    cookieCountElement.innerText = `Cookies: ${cookies}`;
}

// Function to handle cursor upgrades
function buyCursor() {
    if (cookies >= cursorPrice) {
        cookies -= cursorPrice;
        cursors++;
        cursorPrice = Math.floor(cursorPrice * 1.15);
        updateCookieCount();
        updateStore();
    }
}

// Function to handle grandma upgrades
function buyGrandma() {
    if (cookies >= grandmaPrice) {
        cookies -= grandmaPrice;
        grandmas++;
        grandmaPrice = Math.floor(grandmaPrice * 1.15);
        updateCookieCount();
        updateStore();
    }
}

// Function to handle factory upgrades
function buyFactory() {
    if (cookies >= factoryPrice) {
        cookies -= factoryPrice;
        factories++;
        factoryPrice = Math.floor(factoryPrice * 1.15);
        updateCookieCount();
        updateStore();
    }
}

// Function to update the store with current prices
function updateStore() {
    storeElement.innerHTML = `
        <p>Cursors: ${cursors}</p>
        <button onclick="buyCursor()">Buy Cursor (${cursorPrice} cookies)</button>
        <p>Grandmas: ${grandmas}</p>
        <button onclick="buyGrandma()">Buy Grandma (${grandmaPrice} cookies)</button>
        <p>Factories: ${factories}</p>
        <button onclick="buyFactory()">Buy Factory (${factoryPrice} cookies)</button>
    `;
}

// Click event listener for the main button
clickButton.addEventListener('click', () => {
    cookies++;
    updateCookieCount();
});

// Automatic cookie generation based on upgrades
setInterval(() => {
    cookies += cursors;
    cookies += grandmas * 5;
    cookies += factories * 10;
    updateCookieCount();
}, 1000);

// Initial store update
updateStore();
```

This example provides a basic Cookie Clicker game where you start with a single clickable button. As you click, you earn cookies. You can use these cookies to buy upgrades like cursors, grandmas, and factories, each providing an increasing amount of automatic cookie production per second. The prices of the upgrades increase by 15% with each purchase.

**Editor's note:** This was the output from the game, with no changes to the code:

![Cookie Clicker Game](./cookies.png)