commit fac56a30483ffce531d127bf34a8845196ea11f6 Author: Godopu Date: Fri May 1 08:34:32 2026 +0900 Initial Commit diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..454209c --- /dev/null +++ b/.gitignore @@ -0,0 +1,42 @@ +# Python +__pycache__/ +*.py[cod] +*.pyo +*.pyd +*.egg +*.egg-info/ +dist/ +build/ +.eggs/ + +# Virtual environment +venv/ +.venv/ +env/ +.env + +# Environment variables +.env +.env.* + +# pytest +.pytest_cache/ +.cache/ + +# IDE +.idea/ +.vscode/ +*.swp +*.swo + +# macOS +.DS_Store +.AppleDouble + +# Logs +*.log +logs/ + +# Distribution / packaging +*.whl +*.tar.gz diff --git a/backend/main.py b/backend/main.py new file mode 100644 index 0000000..4f2a77e --- /dev/null +++ b/backend/main.py @@ -0,0 +1,69 @@ +import random +from fastapi import FastAPI, Request +from fastapi.responses import HTMLResponse +from fastapi.templating import Jinja2Templates +from pydantic import BaseModel + +app = FastAPI(title="MileageDraw") + +templates = Jinja2Templates(directory="templates") + +# Prize Probabilities: +# 1st Prize: 20% +# 2nd Prize: 30% +# 3rd Prize: 50% +PRIZES = [ + {"rank": 1, "name": "1st Prize", "miles": 10000, "probability": 0.10}, + {"rank": 2, "name": "2nd Prize", "miles": 5000, "probability": 0.30}, + {"rank": 3, "name": "3rd Prize", "miles": 2000, "probability": 0.60}, +] + +class DrawResult(BaseModel): + rank: int + name: str + miles: int + +@app.get("/", response_class=HTMLResponse) +async def index(request: Request): + return templates.TemplateResponse( + request=request, name="index.html" + ) + +@app.post("/api/draw", response_model=DrawResult) +async def draw_prize(): + rand_val = random.random() + cumulative = 0.0 + for prize in PRIZES: + cumulative += prize["probability"] + if rand_val <= cumulative: + return DrawResult( + rank=prize["rank"], + name=prize["name"], + miles=prize["miles"] + ) + + # Fallback in case of floating point precision issues + last = PRIZES[-1] + return DrawResult( + rank=last["rank"], + name=last["name"], + miles=last["miles"] + ) + +if __name__ == "__main__": + import uvicorn + uvicorn.run("main:app", host="0.0.0.0", port=10000, reload=True) + +# import random +# def sum(L, n): +# if n == 0: +# return L[0] +# else: +# return L[n] + sum(L, n-1) + +# L = [random.randint(1, 100) for _ in range(10)] +# print(L) + +# s = sum(L, len(L)-1) +# print(s) + diff --git a/backend/templates/index.html b/backend/templates/index.html new file mode 100644 index 0000000..709efad --- /dev/null +++ b/backend/templates/index.html @@ -0,0 +1,305 @@ + + + + + +MileageDraw - Win Big Today + + + + + + +
+
+ +
+
+
+redeem +
+

MileageDraw

+
+
+ +
+ +
+
+
+
+
+
+ +
+
+

+military_tech + Prize Pool +

+
+
+

1st Prize

+

10,000 Miles

+
+
+

2nd Prize

+

5,000 Miles

+
+
+

3rd Prize

+

2,000 Miles

+
+
+
+
+

+ "Thousands of users have already claimed their rewards this month. Will you be next?" +

+
+
+ +
+
+

Try Your Luck!

+

Open the Mystery Box to win huge rewards

+
+
+ +
+ +
+ +
+featured_seasonal_and_gifts +
+
+
+
+
+
+ +auto_awesome +auto_awesome +auto_awesome +
+
+
+ +

Cost: 500 Miles per draw

+
+
+ +
+
+

Live Winners

+
+
+
+ +
+
+

Alice W.

+

+2,000 Miles

+
+
+
+
+ +
+
+

James K.

+

+10,000 Miles

+
+
+
+
+ +
+
+

Elena R.

+

+500 Miles

+
+
+
+
+
+

Double Odds!

+

Active for the next 24 minutes. Draw now to increase your chances.

+
+
+
+ +
+
+
+verified_user + Provably Fair +
+
+speed + Instant Payouts +
+
+support_agent + 24/7 Support +
+
+

© 2024 MileageDraw Games. Please play responsibly.

+
+
+
+
+ + + + diff --git a/backend/test.py b/backend/test.py new file mode 100644 index 0000000..29f2272 --- /dev/null +++ b/backend/test.py @@ -0,0 +1,5 @@ +import datetime + +print(datetime.date.today()) +print(datetime.time().hour) +print(datetime.datetime.now()) \ No newline at end of file diff --git a/backend/test_probs.py b/backend/test_probs.py new file mode 100644 index 0000000..97a8748 --- /dev/null +++ b/backend/test_probs.py @@ -0,0 +1,27 @@ +import random + +PRIZES = [ + {"rank": 1, "name": "1st Prize", "miles": 10000, "probability": 0.20}, + {"rank": 2, "name": "2nd Prize", "miles": 5000, "probability": 0.30}, + {"rank": 3, "name": "3rd Prize", "miles": 2000, "probability": 0.50}, +] + +def draw_prize(): + rand_val = random.random() + cumulative = 0.0 + for prize in PRIZES: + cumulative += prize["probability"] + if rand_val <= cumulative: + return prize + return PRIZES[-1] + +counts = {1: 0, 2: 0, 3: 0} +trials = 100000 + +for _ in range(trials): + res = draw_prize() + counts[res["rank"]] += 1 + +print("Results for 100,000 trials:") +for rank, count in counts.items(): + print(f"Rank {rank}: {count/trials*100:.2f}%") diff --git a/template/code.html b/template/code.html new file mode 100644 index 0000000..53169f0 --- /dev/null +++ b/template/code.html @@ -0,0 +1,182 @@ + + + + + +MileageDraw - Win Big Today + + + + + + + +
+
+ +
+
+
+redeem +
+

MileageDraw

+
+
+ +
+ +
+
+
+
+
+
+ +
+
+

+military_tech + Prize Pool +

+
+
+

1st Prize

+

10,000 Miles

+
+
+

2nd Prize

+

5,000 Miles

+
+
+

3rd Prize

+

2,000 Miles

+
+
+
+
+

+ "Thousands of users have already claimed their rewards this month. Will you be next?" +

+
+
+ +
+
+

Try Your Luck!

+

Open the Mystery Box to win huge rewards

+
+
+ +
+ +
+ +
+featured_seasonal_and_gifts +
+
+
+
+
+
+ +auto_awesome +auto_awesome +auto_awesome +
+
+
+ +

Cost: 500 Miles per draw

+
+
+ +
+
+

Live Winners

+
+
+
+ +
+
+

Alice W.

+

+2,000 Miles

+
+
+
+
+ +
+
+

James K.

+

+10,000 Miles

+
+
+
+
+ +
+
+

Elena R.

+

+500 Miles

+
+
+
+
+
+

Double Odds!

+

Active for the next 24 minutes. Draw now to increase your chances.

+
+
+
+ +
+
+
+verified_user + Provably Fair +
+
+speed + Instant Payouts +
+
+support_agent + 24/7 Support +
+
+

© 2024 MileageDraw Games. Please play responsibly.

+
+
+
+
+ \ No newline at end of file diff --git a/template/screen.png b/template/screen.png new file mode 100644 index 0000000..12c855f Binary files /dev/null and b/template/screen.png differ