File size: 2,876 Bytes
06f5525
933256c
06f5525
 
 
 
 
 
 
 
307c7a3
06f5525
 
 
 
307c7a3
06f5525
 
 
307c7a3
 
 
 
 
 
 
 
 
 
 
 
 
933256c
 
06f5525
 
 
307c7a3
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
06f5525
 
 
933256c
06f5525
 
 
 
 
 
 
 
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
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Pennyflip</title>
    <link rel="stylesheet" href="{{ url_for('static', filename='styles.css') }}">
</head>
<body>
    <div id="game-container">
        <h1>Pennyflip</h1>
        <div id="info">
            Balance: $<span id="balance">0.00</span> | Flips left: <span id="flips-left">1000</span>
        </div>

        <div id="coin"></div>

        <div id="shop">
            {% for coin in coins %}
            <div class="shop-item" data-index="{{ loop.index0 }}">
                <div class="shop-coin" style="background-color: {{ coin.color }}">
                    <span class="coin-price">${{ "%.2f"|format(coin.price) }}</span>
                </div>
                <div class="coin-name">{{ coin.name }}</div>
                <div class="coin-tooltip">
                    <strong>{{ coin.name }}</strong><br>
                    Cost: ${{ "%.2f"|format(coin.price) }}<br>
                    Value: ${{ "%.2f"|format(coin.value) }}<br>
                    Win rate: {{ "%.2f"|format(coin.winrate) }}<br>
                    {% if coin.ability %}
                    Ability: {{ coin.ability }}
                    {% endif %}
                </div>
            </div>
            {% endfor %}
        </div>

        <button id="generate-coin">Generate New Coin ($4)</button>

        <div id="leaderboard">
            <h2>Leaderboard</h2>
            <table>
                <thead>
                    <tr>
                        <th>Rank</th>
                        <th>Initials</th>
                        <th>Score</th>
                    </tr>
                </thead>
                <tbody>
                    {% for entry in leaderboard %}
                    <tr>
                        <td>{{ loop.index }}</td>
                        <td>{{ entry.initials }}</td>
                        <td>${{ "%.2f"|format(entry.score) }}</td>
                    </tr>
                    {% endfor %}
                </tbody>
            </table>
        </div>

        <div id="game-over" class="modal">
            <div class="modal-content">
                <h2>Game Over</h2>
                <p>Your final score: $<span id="final-score"></span></p>
                <input type="text" id="initials" maxlength="3" placeholder="Enter your initials">
                <button id="submit-score">Submit Score</button>
                <button id="play-again">Play Again</button>
            </div>
        </div>

        <div id="loading-overlay">
            <div class="loading-message">Generating coin...</div>
        </div>
    </div>

    <script>
        var coins = {{ coins|tojson|safe }};
    </script>
    <script src="{{ url_for('static', filename='script.js') }}"></script>
</body>
</html>