Skip to content

Commit

Permalink
Rename variable torpedos to torpedoCount
Browse files Browse the repository at this point in the history
  • Loading branch information
micskeiz committed Apr 10, 2018
1 parent 1bb483c commit 47fc384
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions src/main/java/hu/bme/mit/spaceship/TorpedoStore.java
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,15 @@
*/
public class TorpedoStore {

private int torpedos = 0;
private int torpedoCount = 0;
private Random generator = new Random();

public TorpedoStore(int numberOfTorpedos){
this.torpedos = numberOfTorpedos;
this.torpedoCount = numberOfTorpedos;
}

public boolean fire(int numberOfTorpedos){
if(numberOfTorpedos < 1 || numberOfTorpedos > this.torpedos){
if(numberOfTorpedos < 1 || numberOfTorpedos > this.torpedoCount){
throw new IllegalArgumentException("numberOfTorpedos");
}

Expand All @@ -26,7 +26,7 @@ public boolean fire(int numberOfTorpedos){

if (r > 0.01) {
// successful firing
this.torpedos -= numberOfTorpedos;
this.torpedoCount -= numberOfTorpedos;
success = true;
} else {
// failure
Expand All @@ -37,10 +37,10 @@ public boolean fire(int numberOfTorpedos){
}

public boolean isEmpty(){
return this.torpedos <= 0;
return this.torpedoCount <= 0;
}

public int getNumberOfTorpedos() {
return this.torpedos;
public int getTorpedoCount() {
return this.torpedoCount;
}
}

0 comments on commit 47fc384

Please sign in to comment.