fix: nom etat et ajout fuel

This commit is contained in:
2025-10-30 17:13:51 +01:00
parent c1bc62b879
commit ef30313a25
2 changed files with 39 additions and 6 deletions

View File

@@ -13,6 +13,8 @@ public class Car {
/** Nombre total de cases dans une boucle (doit être > 0) */
private final int loop;
/** Nombre de fuel restant */
private int fuel = 60;
/**
* Construit une nouvelle voiture.
@@ -73,4 +75,15 @@ public class Car {
{
return loop;
}
public int getFuel()
{
return fuel;
}
public Car consumeFuel()
{
fuel -= State.get().getConsumption();
return this;
}
}