diff --git a/src/Game.java b/src/Game.java index 9891d99..391bba6 100644 --- a/src/Game.java +++ b/src/Game.java @@ -64,4 +64,31 @@ public class Game { public void changeLanguage(String language) { this.language.setOutputLanguage(language); } + public boolean checkForWin() { + if((gamefield.getField(1) == gamefield.getField(2)) && (gamefield.getField(3) == gamefield.getField(1))){ + return true; + } + else if((gamefield.getField(4) == gamefield.getField(5)) && (gamefield.getField(6) == gamefield.getField(4))){ + return true; + } + else if((gamefield.getField(7) == gamefield.getField(8)) && (gamefield.getField(9) == gamefield.getField(7))){ + return true; + } + else if((gamefield.getField(1) == gamefield.getField(4)) && (gamefield.getField(7) == gamefield.getField(1))){ + return true; + } + else if((gamefield.getField(2) == gamefield.getField(5)) && (gamefield.getField(8) == gamefield.getField(2))){ + return true; + } + else if((gamefield.getField(3) == gamefield.getField(6)) && (gamefield.getField(9) == gamefield.getField(3))){ + return true; + } + else if((gamefield.getField(1) == gamefield.getField(5)) && (gamefield.getField(9) == gamefield.getField(1))){ + return true; + } + else if((gamefield.getField(3) == gamefield.getField(5)) && (gamefield.getField(7) == gamefield.getField(3))){ + return true; + } + return false; + } }