Baulder's Gate test

This commit is contained in:
Foxpolar 2024-12-30 15:45:41 +03:00
commit eb361f1f9f
5 changed files with 90 additions and 0 deletions

1
.gitignore vendored Normal file
View File

@ -0,0 +1 @@
venv/

24
site/app.py Normal file
View File

@ -0,0 +1,24 @@
from flask import Flask, render_template, request
app = Flask(__name__)
@app.route('/')
def index():
return render_template("index.html")
@app.route("/result", mathods=["POST"])
def result():
answers = request.form
character = determine_character(answers)
return render_template("result.html", character=character)
def datermine_character(answers):
if answers.get("question1") == "brave":
return "Minsc"
elif answers.get("question1") == "wise":
return "Jeheira"
else:
return "Imoem"
if __name__=="__main__":
app.run(debug=True)

29
site/static/css/style.css Normal file
View File

@ -0,0 +1,29 @@
body {
font-family: Arial, sans-serif;
background-color: #f4f4f4;
text-align: center;
margin: 0;
padding: 0;
}
h1 {
color: #333;
}
form {
margin: 20px auto;
padding: 20px;
background: #fff;
border-radius: 8px;
width: 300px;
box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
}
button {
padding: 10px 20px;
background: #007bff;
color: #fff;
border: none;
border-radius: 4px;
cursor: pointer;
}

23
site/templates/index.html Normal file
View File

@ -0,0 +1,23 @@
<!DOCKTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Baldur's Gate Quiz</title>
<link rel="stylesheet" href="{{ url_for('static', filename='css/style.css')}}">
</head>
<body>
<h1>Who Are you in Baldur's Gate?</h1>
<form action="/result" method="POST">
<p>1. What trait best describes you?</p>
<input type="radio" name="question1" value="brave" id="brave">
<label for="brave">Brave</label><br>
<input type="radio" name="question1" value="wise" id="wise">
<label for="wise">Wise</label><br>
<input type="radio" name="question1" value="kind" id="kind">
<label for="kind">Kind</label><br><br>
<button type="submit">Find Out</button>
</form>
</body>
</html>

View File

@ -0,0 +1,13 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Your Baldur's Gate Character</title>
<link rel="stylesheet" href="{{ url_for('static', filename='css/style.css') }}">
</head>
<body>
<h1>You are {{ character }}!</h1>
<a href="/">Try Again</a>
</body>
</html>