putting the project on git

This commit is contained in:
Giovanni-Josserand 2025-09-14 12:33:51 +02:00
commit 58693ebe02
20 changed files with 1647 additions and 0 deletions

1001
LOTAstats.csv Normal file

File diff suppressed because it is too large Load Diff

Binary file not shown.

Binary file not shown.

87
fonctions.py Normal file
View File

@ -0,0 +1,87 @@
# -*- coding: utf-8 -*-
import csv
LOTAstats_csv = open('LOTAstats.csv','r', encoding ='utf-8')
lecteur = csv.DictReader(LOTAstats_csv, delimiter=',')
LOTA = list(lecteur)
def joueur_testeur(kill,power):
fruit1 = [kill,power]
liste_fruits = []
for fruit in LOTA:
liste_fruits.append((fruit['classe'],int(fruit['frags']),int(fruit['death'])))
test = k_plus_proches(fruit1, liste_fruits,10)
return(test)
from math import sqrt
def distance3D(point_a,point_b):
dist_a_b = sqrt((point_a[0] - point_b[0])**2 + (point_a[1] - point_b[1])**2 )
return dist_a_b
def k_plus_proches(point,liste,k):
dist = []
for a in range (0,len(liste)):
dist.append([])
dist[a].append(distance3D(point,[int(liste[a][1]),int(liste[a][2])]))
dist[a].append(liste[a][0])
k_voisins = []
for e in range (0,k):
plus_petit = dist[0]
plus_petit_index = 0
for f in range (0,len(dist)):
if plus_petit[0] > dist[f][0]:
plus_petit = dist[f]
plus_petit_index = f
k_voisins.append(plus_petit)
dist.pop(plus_petit_index)
return k_voisins
def classejoueur (kill,death):
resulta = joueur_testeur(kill,death)
nombreproche = []
for a in range (0,len(resulta)):
vrai = 0
for b in range (0,len(nombreproche)):
if nombreproche[b][1] == resulta[a][1]:
nombreproche[b][0] += 1
vrai = 1
if vrai == 0 :
nombreproche.append([])
nombreproche[len(nombreproche)-1].append(1)
nombreproche[len(nombreproche)-1].append(resulta[a][1])
indexplus = 0
valeurplus = 0
for a in range (0,len(nombreproche)):
if nombreproche[a][0]>valeurplus:
indexplus = a
valeurplus = nombreproche[a][0]
return(nombreproche[indexplus][1])
def tour(rang):
if rang == 'tomato':
toure = "1 er tour"
elif rang == 'mauvais':
toure = "2 er tour"
elif rang == 'moyen':
toure = "3 eme tour"
elif rang == 'bon':
toure = "4 eme tour"
elif rang == 'unicum':
toure = "tour ultime"
return (toure)

BIN
static/IMG/celestial.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.9 KiB

BIN
static/IMG/fleche.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 327 B

BIN
static/IMG/fleche1.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 390 B

BIN
static/IMG/logo.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 200 KiB

BIN
static/IMG/passage.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 133 KiB

BIN
static/IMG/petit_logo.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.5 KiB

BIN
static/IMG/titre.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

BIN
static/fonts/DIN.ttf Normal file

Binary file not shown.

BIN
static/fonts/Valorant.ttf Normal file

Binary file not shown.

BIN
static/fonts/ahronbd.ttf Normal file

Binary file not shown.

321
static/styles/style.css Normal file
View File

@ -0,0 +1,321 @@
@font-face {
font-family: "Aharoni";
src: url("../fonts/ahronbd.ttf") format("truetype");
}
@font-face {
font-family: "Valorant";
src: url("../fonts/Valorant.ttf") format("truetype");
}
@font-face {
font-family: "DIN";
src: url("../fonts/DIN.ttf") format("truetype");
}
body {
background: white;
text-align: center;
color: white;
margin: 0;
padding: 0;
}
a {
text-decoration: none;
color: white;
}
/*
CSS pour le header
*/
header {
font-size: 50px;
width: 100%;
margin: 0;
padding:0;
background-position: center;
}
.bandeau {
background-color: black;
font-size: 15px;
display: flex;
margin: 0;
padding: 0;
white-space: nowrap;
height: 75px;
font-family: DIN;
align-items: center;
}
.marge_gauche {
margin-left: 25px;
}
nav ul {
list-style-type: none;
margin: 0;
padding: 0;
display: flex;
}
.menu_sl {
z-index: 1;
margin-top: 2px;
visibility: hidden;
position: absolute;
width: 100px;
height: 0px;
background-color: #292929;
transition: all .1s ease;
margin-left: -9.5px;
}
.menu:hover .menu_sl {
height: 100px;
visibility: visible;
}
.menu_sl ul {
font-size: 12px;
flex-direction: column;
text-align: start;
}
.menu_sl ul li {
margin-top: 8%;
}
.autre {
margin: 0 10px;
}
nav span {
color: #fff;
text-decoration: none;
padding: 10px;
display: block;
}
nav span:hover {
cursor: pointer;
box-shadow: 0 2px 0 0;
}
.conexion{
display: flex;
justify-content: end;
width: -moz-available; width: -webkit-fill-available;
}
.entete {
position: relative;
z-index: 0;
}
video {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
object-fit: cover;
z-index: -1;
}
.elm {
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
}
.title {
border-top: 100px solid transparent;
}
.entete img,
.entete button {
position: relative;
z-index: 1;
margin: 0;
padding: 0;
}
.button {
border-top: 25px solid transparent;
border-bottom: 150px solid transparent;
}
.download {
border: none;
cursor: pointer;
font-weight: bold;
font-size: 14px;
border: 1px solid white;
}
.download_lg {
position: relative;
display: block;
padding: 15px 30px;
overflow: hidden;
color: #fff;
background-color: #ff4655;
}
.download_sl {
position: absolute;
top: 0;
bottom: -1px;
left: -8px;
width: 0;
background-color: #0f1923;
transform: skew(-15deg);
transition: all .2s ease;
}
.download_text {
position: relative;
}
.download:hover .download_sl {
width: calc(100% + 15px);
}
.triangle {
width: 0;
height: 0;
border-bottom: 50px solid white;
border-right: 50px solid transparent;
}
/*
CSS pour le main
*/
main {
display: flex;
flex-direction: row;
margin-bottom: 8%
}
main h1 {
color: #de2f3d;
font-family: DIN;
font-size: 90px;
text-align: start;
}
.inscription {
display: flex;
flex-direction: column;
margin-left: 5%;
}
.carte {
display: flex;
justify-content: center;
align-items: center;
height: 100%;
}
.card {
display: flex;
background-color: #0f131f;
box-shadow: 12px 17px 51px #151f2b;
border-radius: 12px;
font-family: Aharoni;
justify-content: center;
flex-direction: column;
color: white;
width: 300px;
padding: 1% 5% 3% 5%;
margin-top: -10%;
}
.result {
height: 350px;
}
.info {
position: relative;
margin-bottom: 8%;
}
input {
border: 0;
border-bottom: 2px #fff solid;
background: transparent;
color: white;
align-items: center;
display: block;
padding: 10px 0;
font-size: auto;
outline: none;
width: 300px;
}
label {
position: absolute;
top: 0;
left: 0;
padding: 10px 0;
font-size: 15px;
pointer-events: none;
transition: .5s;
}
input:focus ~ label,
input:valid ~ label {
top: -20px;
font-size: 12px;
}
.envoyer {
padding: 1em 2.5em;
border-radius: 6em;
transition: all .2s;
border: none;
background-color: white;
}
.envoyer:hover {
transform: translateY(-3px);
box-shadow: 0 10px 20px rgba(0, 0, 0, 0.2);
cursor: pointer;
}
.deroulement {
display: flex;
justify-content: right;
align-items: right;
flex-direction: column;
width: -moz-available; width: -webkit-fill-available;
margin-right: 5%;
margin-left: 5%;
color: black;
text-align: start;
font-family: sans-serif;
}
.tournoi_texte {
margin-top: -50px;
}
/*
CSS pour le footer
*/
footer {
background-color: black;
color: white;
text-align: center;
padding: 10px;
}

BIN
static/videos/video.mp4 Normal file

Binary file not shown.

111
templates/index.html Normal file
View File

@ -0,0 +1,111 @@
<!doctype html>
<html lang="fr">
<head>
<meta charset="utf-8">
<title>League of the Ancient</title>
<link rel= "stylesheet" type= "text/css" href= "{{ url_for('static',filename='../static/styles/style.css') }}">
<link rel="icon" type="image/png" href="{{ petit_logo }}" />
<link rel="stylesheet" type="text/css" href="../static/styles/style.css">
</head>
<body>
<header>
<div class="bandeau">
<img class="marge_gauche" src="{{celestial}}">
<img class="marge_gauche" src="{{petit_logo}}">
<nav>
<ul>
<li class="menu">
<span>NOS JEUX <img src="{{fleche}}"></span>
<span class="menu_sl">
<ul>
<li> ROCKET LIT GUEUX </li>
<li> C'EST LAID STE </li>
<li> VA LAURENT ! </li>
<li> A L'EAU </li>
</ul>
</span>
</li>
<li class="autre"><span><a href="http://localhost:5000/"> TOURNOIS </a></span></li>
<li class="autre"><span>PARTENAIRE</span></li>
<li class="autre"><span><a href="https://www.craft.do/s/om2gVyYQgdSiCB"> COMPTE RENDUS </a></span></li>
</ul>
</nav>
<nav class="conexion">
<ul>
<li><span>CONNEXION</span></li>
</ul>
</nav>
</div>
<div class="entete">
<video autoplay muted loop>
<source type="video/mp4" src="../static/videos/video.mp4">
</video>
<div class="elm">
<div class="title">
<img src="{{titre}}">
</div>
<a href="{{url_for('download')}}">
<button class="download">
<span class="download_lg">
<span class="download_sl"></span>
<span class="download_text">JOUEZ GRATUITEMENT</span>
</span>
</button>
</a>
</div>
<div class="triangle"></div>
</div>
</header>
<main >
<div class="inscription">
<h1>INSCRIPTION</h1>
<div class="carte">
<article class="card">
<h2> Formulaire </h2>
<form action="http://localhost:5000/resultat" method="post">
<div class="info">
<input type="number" name="frags" class="input" required="">
<label>Frags/game</label>
</div>
<div class="info">
<input type="number" name="death" class="input" required="">
<label>Death/game</label>
</div>
<div class="info">
<input type="dist" name="number" class="input" required="">
<label>Distance parcourue</label>
</div>
<div class="info">
<input type="number" name="power" class="input" required="">
<label>Powerup</label>
</div>
<button class="envoyer" type="submit"> Envoyer </button>
</form>
</article>
</div>
</div>
<div class="deroulement">
<h1>DEROULEMENT</h1>
<p class="tournoi_texte"> Ce tournoi se passe sous forme de duel pour determiner les plus forts ! Pour eviter de perdre des le debut, nous avons choisi de vous faire vous affronter celon votre niveau respetif. Pour ce faire, vous devrez remplir un formulaire et y inscrire vos statistiques de la saison derniere. Apres quoi un rang vous sera attribue pour le tournoi ainsi que le tour auquel vous passerez. </p>
<img src='{{passage}}'>
</div>
</main>
<footer>
<p>© 2023 Créé par Celestial eclipse</p>
<img class="marge_gauche" src="{{celestial}}">
<img class="marge_gauche" src="{{petit_logo}}">
</footer>
</body>
</html>

86
templates/resultat.html Normal file
View File

@ -0,0 +1,86 @@
<!doctype html>
<html lang="fr">
<head>
<meta charset="utf-8">
<title>League of the Ancient</title>
<link rel= "stylesheet" type= "text/css" href= "{{ url_for('static',filename='styles/style.css') }}">
<link rel="icon" type="image/png" href="{{ petit_logo }}" />
<link rel="stylesheet" type="text/css" href="style.css">
</head>
<body>
<header>
<div class="bandeau">
<img class="marge_gauche" src="{{celestial}}">
<img class="marge_gauche" src="{{petit_logo}}">
<nav>
<ul>
<li class="menu">
<span>NOS JEUX <img src="{{fleche}}"></span>
<span class="menu_sl">
<ul>
<li> ROCKET LIT GUEUX </li>
<li> C'EST LAID STE </li>
<li> VA LAURENT ! </li>
<li> A L'EAU </li>
</ul>
</span>
</li>
<li class="autre"><span><a href="http://localhost:5000/"> TOURNOIS </a></span></li>
<li class="autre"><span>PARTENAIRE</span></li>
<li class="autre"><span><a href="https://www.craft.do/s/om2gVyYQgdSiCB"> COMPTE RENDUS </a></span></li>
</ul>
</nav>
<nav class="conexion">
<ul>
<li><span>CONNEXION</span></li>
</ul>
</nav>
</div>
<div class="entete">
<video autoplay muted loop>
<source type="video/mp4" src="../static/videos/video.mp4">
</video>
<div class="elm">
<div class="title">
<img src="{{titre}}">
</div>
<a href="{{url_for('download')}}">
<button class="download">
<span class="download_lg">
<span class="download_sl"></span>
<span class="download_text">JOUEZ GRATUITEMENT</span>
</span>
</button>
</a>
</div>
<div class="triangle"></div>
</div>
</header>
<main>
<div class="inscription">
<h1>INSCRIPTION</h1>
<div class="carte">
<article class="card result">
<h2>Felicitation</h2>
<p> Le rang {{classe}} vous a ete attribue. Vous passerez donc au {{toure}}. Bonne chance a vous !</p>
</article>
</div>
</div>
<div class="deroulement">
<h1>DEROULEMENT</h1>
<p class="tournoi_texte"> Ce tournoi se passe sous forme de duel pour determiner les plus forts ! Pour eviter de perdre des le debut, nous avons choisi de vous faire vous affronter celon votre niveau respetif. Pour ce faire, vous devrez remplir un formulaire et y inscrire vos statistiques de la saison derniere. Apres quoi un rang vous sera attribue pour le tournoi ainsi que le tour auquel vous passerez. </p>
<img src='{{passage}}'>
</div>
</main>
</body>
<footer>
<p>© 2023 Créé par Celestial eclipse</p>
<img class="marge_gauche" src="{{celestial}}">
<img class="marge_gauche" src="{{petit_logo}}">
</footer>
</html>

41
views.py Normal file
View File

@ -0,0 +1,41 @@
# -*- coding: utf-8 -*-
from flask import Flask, render_template, send_file, request
import os
from fonctions import classejoueur, tour
app = Flask(__name__)
IMG_FOLDER = os.path.join('static', 'IMG')
app.config['UPLOAD_FOLDER'] = IMG_FOLDER
@app.route('/')
def index():
petit_logo = os.path.join(app.config['UPLOAD_FOLDER'], 'petit_logo.png')
celestial = os.path.join(app.config['UPLOAD_FOLDER'], 'celestial.png')
titre = os.path.join(app.config['UPLOAD_FOLDER'], 'titre.png')
fleche = os.path.join(app.config['UPLOAD_FOLDER'], 'fleche.png')
passage = os.path.join(app.config['UPLOAD_FOLDER'], 'passage.png')
return render_template('index.html', petit_logo=petit_logo, celestial=celestial,
titre=titre, fleche=fleche, passage=passage)
@app.route('/download')
def download():
jeu = 'static/download_files/cube runner_red alert.rar'
return send_file(jeu, as_attachment=True)
@app.route('/resultat',methods = ['POST'])
def resultat():
result = request.form
f = int(result['frags'])
d = int(result['death'])
c=classejoueur(f, d)
t=tour(c)
petit_logo = os.path.join(app.config['UPLOAD_FOLDER'], 'petit_logo.png')
celestial = os.path.join(app.config['UPLOAD_FOLDER'], 'celestial.png')
titre = os.path.join(app.config['UPLOAD_FOLDER'], 'titre.png')
fleche = os.path.join(app.config['UPLOAD_FOLDER'], 'fleche.png')
passage = os.path.join(app.config['UPLOAD_FOLDER'], 'passage.png')
return render_template("resultat.html", frags=f, death=d, classe=c, toure=t,
petit_logo=petit_logo, celestial=celestial, titre=titre,
fleche=fleche, passage=passage)
app.run(debug=True)