Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Killian
Pokemon battle simulator
Commits
3914fdd8
Commit
3914fdd8
authored
Feb 12, 2018
by
Quentin
Browse files
add player definition
parent
661c1350
Changes
1
Hide whitespace changes
Inline
Side-by-side
player.ts
0 → 100644
View file @
3914fdd8
import
{
Pokemon
,
display
}
from
"
./pokemon
"
;
export
interface
Player
{
name
:
string
pokemons
:
Array
<
Pokemon
>
}
//Modifie et retourne un joueur après le k.o. de son ième pokemon
//Prérequis : 0 <= entier(position) < nombre de pokemon
export
function
pokemonKo
(
player
:
Player
,
position
:
number
)
:
Player
{
console
.
log
(
player
.
pokemons
[
position
].
name
+
"
est k.o.
"
);
player
.
pokemons
.
splice
(
position
,
1
);
//retrait du pokemon de la liste
if
(
player
.
pokemons
.
length
>
0
)
{
console
.
log
(
player
.
name
+
"
fait appel à
"
+
display
(
player
.
pokemons
[
0
]));
}
return
player
;
}
\ No newline at end of file
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment