Skip to content
Snippets Groups Projects
Commit 610fe015 authored by zalavari's avatar zalavari
Browse files

No longer asks the user, whether the hole's open or not (it knows by

itself)
parent 5874e14c
No related branches found
No related tags found
No related merge requests found
package killer_sokoban;
import java.util.Scanner;
import java.util.ArrayList;
public class SwitchableHole extends SimpleField {
boolean opened=true;
boolean opened=false;
/**Ez a függvény azt jelzi a mező számára, hogy szeretnének rálépni.
* @param toward melyik irányból szeretnének rálépni
......@@ -18,31 +13,10 @@ public class SwitchableHole extends SimpleField {
@Override
public boolean accept(Direction toward, Worker w, Moveable m) {
System.out.println("Nyitva van a lyuk? (I/N)");
Scanner sc = new Scanner(System.in);
String valasz=sc.next();
if(valasz.equals("I")||valasz.equals("i")) {
open();
}
else if(valasz.equals("N")||valasz.equals("n")) {
close();
}
else
{
System.out.println("Hülyeséget válaszoltál, nem vállalom a felelősséget!");
}
boolean ret=true;
if (!opened)
{
ret=super.accept(toward, w, m);
}
......@@ -53,11 +27,9 @@ public class SwitchableHole extends SimpleField {
m.move(this);
m.kill();
ret=true;
}
return ret;
}
......@@ -78,17 +50,13 @@ public class SwitchableHole extends SimpleField {
*/
public void close()
{
opened=false;
}
public void printStat()
{
super.printStat();
System.out.println("opened: " + opened);
}
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment