File tree Expand file tree Collapse file tree 1 file changed +10
-5
lines changed
Expand file tree Collapse file tree 1 file changed +10
-5
lines changed Original file line number Diff line number Diff line change @@ -29,11 +29,16 @@ public static String move(String oldState, String moveText) {
2929 // check for victory
3030 // - convert state to integer
3131 int stateInt = toInt (oldchar , movchar [0 ]);
32- logger .warn ("state int: " + stateInt );
32+ logger .info ("state int: " + stateInt );
3333 // - compare
3434 boolean win = checkWin (stateInt );
35-
36-
35+ if ( win ) {
36+ if ( movchar [0 ] == 'X' ) {
37+ oldchar [0 ] = 'A' ;
38+ } else {
39+ oldchar [0 ] = 'B' ;
40+ }
41+ }
3742 String newState = new String (oldchar );
3843 return newState ;
3944 }
@@ -54,8 +59,8 @@ public static boolean checkWin(int state) {
5459 for ( int i = 0 ; i < 8 ; i ++ ){
5560 int combinedState = winningStates [i ] & state ;
5661 if ( combinedState == winningStates [i ]) {
57- logger .warn ("winning state: " + state );
58- logger .warn ("matches: " + winningStates [i ]);
62+ logger .info ("winning state: " + state );
63+ logger .info ("matches: " + winningStates [i ]);
5964 return true ;
6065 }
6166 }
You can’t perform that action at this time.
0 commit comments