I'm writing some Java code to implement the Connect 4 game. A winner is declared when a player places four chips in a row, either horizontally, vertically or diagonally. Obviously I could write some for loops and check for a winner each time but would like some advice on doing it more elegantly. I was thinking about adding all winning combinations to some data structure and just checking the combinations the last move made is involved in but I'm not sure if that is possible or how to implement it. I am new to Java so any tips or advice on what data structure to use or how to implement would be much appreciated. Thanks
Edit: Ok, could someone please advise me on where to start to implement the guys answer here: algorithm to check a connect four field