Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
A
Apicasoft Init - Bataille Navale
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Adhavane Moudougannane
Apicasoft Init - Bataille Navale
Commits
20db6a6a
Commit
20db6a6a
authored
1 year ago
by
Thibault Delaby
Browse files
Options
Downloads
Plain Diff
sMerge branch 'feature/iteration_main'
parents
16e7b442
e65d5250
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
main.sh
+47
-0
47 additions, 0 deletions
main.sh
with
47 additions
and
0 deletions
main.sh
+
47
−
0
View file @
20db6a6a
#! /usr/bin/env bash
plateau_h
=
10
plateau_w
=
J
bateau_restant1
=
5
bateau_restant2
=
5
source
menu.sh
source
creer_plateau.sh
source
initialise_environnement.sh
source
affiche_plateau.sh
source
demander_case_user.sh
source
getCase.sh
source
updateCase.sh
source
checkTir.sh
function
main
{
initialisation
creer_plateau
$plateau_h
$plateau_w
menu
clear
demander_placement_navires 1
clear
demander_placement_navires 2
clear
while
[
$bateau_restant1
-ne
0
]||[
$bateau_restant2
-ne
0
]
do
case_vise
=
$(
demander_case 1
)
colonne_vise
=
${
$case_vise
:0:1
}
ligne_vise
=
${
$case_vise
:1:1
}
etat
=
checkTir
$colonne_vise
$ligne_vise
2
if
[
$etat
-eq
1
]
then
echo
"Touché"
bateau_restant2
=
$((
$bateau_restant2
-
1
))
else
echo
"Raté!"
fi
read
-p
"Appuyer sur n'importe quelle touche pour passer au joueur 2"
clear
case_vise
=
$(
demander_case 2
)
colonne_vise
=
${
$case_vise
:0:1
}
ligne_vise
=
${
$case_vise
:1:1
}
etat
=
checkTir
$colonne_vise
$ligne_vise
1
if
[
$etat
-eq
1
]
then
echo
"Touché"
bateau_restant1
=
$((
$bateau_restant1
-
1
))
else
echo
"Raté!"
fi
read
-p
"Appuyer sur n'importe quelle touche pour passer au joueur 1"
clear
done
if
[
$bateau_restant1
-eq
0
]
then
echo
"Le joueur 1 a gagné!"
| cowsay
else
echo
"Le joueur 2 a gagné!"
| cowsay
fi
}
main
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment