diff --git a/src/main/java/de/icaotix/ultimatetictactoe/viewmodel/UltimateTicTacToePanelViewModel.java b/src/main/java/de/icaotix/ultimatetictactoe/viewmodel/UltimateTicTacToePanelViewModel.java index a45ce78..e754fa8 100644 --- a/src/main/java/de/icaotix/ultimatetictactoe/viewmodel/UltimateTicTacToePanelViewModel.java +++ b/src/main/java/de/icaotix/ultimatetictactoe/viewmodel/UltimateTicTacToePanelViewModel.java @@ -2,7 +2,6 @@ package de.icaotix.ultimatetictactoe.viewmodel; import de.icaotix.ultimatetictactoe.model.IUltimateTicTacToe; -import de.icaotix.ultimatetictactoe.model.ModelFactory; import de.icaotix.ultimatetictactoe.model.definitions.GameState; import java.util.function.Consumer; @@ -14,12 +13,12 @@ public class UltimateTicTacToePanelViewModel { private Consumer gameResultCallback; private Consumer currentPlayerCallback; - public UltimateTicTacToePanelViewModel(ModelFactory modelFactory, ViewModelFactory viewModelFactory) { + public UltimateTicTacToePanelViewModel(IUltimateTicTacToe ultimateTicTacToe, ViewModelFactory viewModelFactory) { this.subGameViewModels = new TicTacToePanelViewModel[9]; for (int i = 0; i < this.subGameViewModels.length; i++) { this.subGameViewModels[i] = viewModelFactory.getTicTacToePanelViewModel(this); } - this.ultimateTicTacToe = modelFactory.getUltimateTicTacToe(); + this.ultimateTicTacToe = ultimateTicTacToe; } public void prepareNextMove() { diff --git a/src/main/java/de/icaotix/ultimatetictactoe/viewmodel/ViewModelFactory.java b/src/main/java/de/icaotix/ultimatetictactoe/viewmodel/ViewModelFactory.java index b8f3f72..280a355 100644 --- a/src/main/java/de/icaotix/ultimatetictactoe/viewmodel/ViewModelFactory.java +++ b/src/main/java/de/icaotix/ultimatetictactoe/viewmodel/ViewModelFactory.java @@ -11,7 +11,8 @@ public class ViewModelFactory { } public UltimateTicTacToePanelViewModel getUltimateTicTacToePanelViewModel() { - return new UltimateTicTacToePanelViewModel(this.modelFactory, this); + var ultimateTicTacToeGame = this.modelFactory.getUltimateTicTacToe(); + return new UltimateTicTacToePanelViewModel(ultimateTicTacToeGame, this); } public TicTacToePanelViewModel getTicTacToePanelViewModel(UltimateTicTacToePanelViewModel ultimateTicTacToePanelViewModel) {