feat: ship class and test

This commit is contained in:
Smigz 2024-02-20 14:22:30 -05:00
parent 36bf0c07d6
commit 685020dc94
14 changed files with 9884 additions and 0 deletions

View file

View file

@ -0,0 +1,16 @@
class Ship {
constructor(length) {
this.length = length;
this.hits = 0;
}
hit() {
this.hits += 1
}
isSunk() {
return this.hits === this.length
}
}
export { Ship }

0
battleship/src/index.js Normal file
View file