Skip to content
Snippets Groups Projects
Commit 7e43826e authored by Leo's avatar Leo
Browse files

update afficher_plateau

parent 4b93dd2b
No related branches found
No related tags found
No related merge requests found
#!/usr/bin/env bash
# $1 est une liste des coo de pomme, $2 est une liste du corps du snake, $3 est un entier de la longueur du plateau
function afficher_plateau {
for i in {0.."$3"}
for i in {0.."$plateau_longueur"}
do
for y in {0.."$3"}
do
if [ "$i" -eq 0 ] || [ "$y" -eq 0 ] || [ "$i" -eq getPlateauLongueur ] || [ "$y" -eq getPlateauLargeur ]
if [ "$i" -eq 0 ] || [ "$y" -eq 0 ] || [ "$i" -eq "$plateau_longueur" ] || [ "$y" -eq "$plateau_longueur" ]
then
echo -n " ⬛";
elif test "$i" -eq "${1[0]}" && test "$y" -eq "${1[1]}"
elif test "$i" -eq "${pomme[0]}" && test "$y" -eq "${pomme[1]}"
then
echo -n " 🟥";
else
body_part=0
for part in "${2[@]}"; do
for part in "${snake_body[@]}"; do
IFS="," read part_x part_y <<< "$part"
if [[ "$i" -eq "$part_x" && "$y" -eq "$part_y" ]]; then
echo -n " 🟩"
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment