MCPcopy Create free account
hub / github.com/aws-samples/eb-java-scorekeep / checkWin

Method checkWin

src/main/java/scorekeep/TicTacToe.java:100–111  ·  view source on GitHub ↗
(int state)

Source from the content-addressed store, hash-verified

98 * 100100100 292 001010100 84
99 */
100 public static boolean checkWin(int state) {
101 int[] winningStates = {7,56,73,84,146,273,292,448};
102 for ( int i = 0; i < 8; i++ ){
103 int combinedState = winningStates[i] & state;
104 if ( combinedState == winningStates[i]) {
105 logger.info("winning state: " + state);
106 logger.info("matches: " + winningStates[i]);
107 return true;
108 }
109 }
110 return false;
111 }
112}

Callers 3

gameplayTestMethod · 0.95
checkWinTestMethod · 0.95
moveMethod · 0.95

Calls

no outgoing calls

Tested by 2

gameplayTestMethod · 0.76
checkWinTestMethod · 0.76