From 2036a3d0349448aff80f8772f2d72d44c751fac9 Mon Sep 17 00:00:00 2001 From: clara Date: Tue, 13 May 2025 15:47:15 +0200 Subject: [PATCH] new method to get the last move to undo the last move after --- src/backend/Board.java | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/backend/Board.java b/src/backend/Board.java index 373adbe..e9ac46f 100644 --- a/src/backend/Board.java +++ b/src/backend/Board.java @@ -262,7 +262,12 @@ public class Board { return false; } - public void undoLastMove() { + public void getLastMove (int x, int y) {// it saves the current state before making a move + + previousStates.add(new Board(this)); // Use the existing constructor to create a copy + } + + public void undoLastMove() { }