Turned abstract methods into an interface

This commit is contained in:
2025-10-29 14:37:31 +01:00
parent 068337e01b
commit 13bac113b7
2 changed files with 11 additions and 6 deletions

View File

@@ -1,10 +1,10 @@
package org.toop.game; package org.toop.game;
import org.toop.game.enumerators.GameState; import org.toop.game.interfaces.Playable;
import java.util.Arrays; import java.util.Arrays;
public abstract class Game { public abstract class Game implements Playable {
public record Move(int position, char value) {} public record Move(int position, char value) {}
public static final char EMPTY = (char)0; public static final char EMPTY = (char)0;
@@ -28,8 +28,4 @@ public abstract class Game {
columnSize = other.columnSize; columnSize = other.columnSize;
board = Arrays.copyOf(other.board, other.board.length); board = Arrays.copyOf(other.board, other.board.length);
} }
public abstract Move[] getLegalMoves();
public abstract GameState play(Move move);
} }

View File

@@ -0,0 +1,9 @@
package org.toop.game.interfaces;
import org.toop.game.Game;
import org.toop.game.enumerators.GameState;
public interface Playable {
Game.Move[] getLegalMoves();
GameState play(Game.Move move);
}