Skip to content

Commit

Permalink
Merge pull request #42 from Ivan23BG/bouton-home-awale
Browse files Browse the repository at this point in the history
Bouton home awale
  • Loading branch information
Bon-Monsieur authored Apr 22, 2024
2 parents f167303 + 889b9e2 commit 951c28c
Show file tree
Hide file tree
Showing 3 changed files with 43 additions and 14 deletions.
3 changes: 0 additions & 3 deletions src/main/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -267,18 +267,15 @@ def awaleia_place_piece():
print(winner)
if winner == 1 or winner == 2:
print(winner,"OUI!!")

return jsonify({'winner': current_IA, 'game_over': True,'iamove':iamove,'values':values,'score_1':scores[0],'score_2':scores[1]})

except Exception as e:
print("OUI!!")
# Handle the exception here
error_message = str(e) # Get the error message

board_awale.display_board()
values = board_awale.get_board()
scores = board_awale.get_scores()

print("error: ", error_message)
return jsonify({'error': "An error has occured"}), 400
print("iamove",iamove)
Expand Down
34 changes: 31 additions & 3 deletions src/main/game_ui/static/css/home_awale_styles.css
Original file line number Diff line number Diff line change
Expand Up @@ -195,14 +195,42 @@ body {
padding: 0;
line-height: 40px;
transform: translate(-10%, 0%);
background-color: #22AAA1;
background-color: #875234;
border-radius: 10px;
transition: transform .1s;
font-size: 95%;
font-weight: 575;
}

.color_button:hover {
background-color: #4CE0D2;
background-color: #cc945b;
transform: scale(1.1) translate(-10%, 0%);
}
}

/* Ajoutez ces règles CSS dans votre fichier home_awale_styles.css */

.choose_color {
display: row;
justify-content: center;
align-items: column;
}

.color_button {
display: flex;
margin: 10px;
}

.containeIA {
margin-left: 5.5%;
display: flex;
align-items: center; /* Aligne les éléments verticalement */
}


.selected_2{
background-color: #cc945b;
}

.selected_2:hover{
background-color: #cc945b;
}
20 changes: 12 additions & 8 deletions src/main/game_ui/templates/home_awale.html
Original file line number Diff line number Diff line change
Expand Up @@ -16,17 +16,21 @@ <h1><center>Awale</center></h1>
<form action="/game_awale" method="post">
<div class="start_game1v1" type="button" onclick="submitForm(1)">Player vs Player</div>
</form>
<form action="/game_awaleia" method="post">
<input type="hidden" id="player" name="player" value="" />
<div class="start_gameIA" type="button" onclick="submitForm(2)">Player vs IA</div>
</form>
<div class = "containeIA">
<form action="/game_awaleia" method="post">
<input type="hidden" id="player" name="player" value="" />
<div class="start_gameIA" type="button" onclick="submitForm(2)">Player vs IA</div>
</form>
<div class="choose_color">
<div class="chooseplayer_blue color_button selected_2" id="button_red" onclick="player_red()">Red</div>
<div class="chooseplayer_red color_button" id="button_blue" onclick="player_blue()">Blue</div>
</div>
</div>

<form action="/game_awaleiaia" method="post">
<div class="start_gameIAvsIA" type="button" onclick="submitForm(3)">IA vs IA</div>
</form>
<div id="choose_color">
<div class="chooseplayer_blue color_button selected_2" id="button_red" onclick="player_red()">red</div>
<div class="chooseplayer_red color_button" id="button_blue" onclick="player_blue()">blue</div>
</div>

<div class="button_out"></div>
</div>
<script src="../static/js/home_awale.js"></script>
Expand Down

0 comments on commit 951c28c

Please sign in to comment.