Skip to main content

Posts

Featured

tik-tac-toc game main activity code

public class MainActivity extends ActionBarActivity { // 0 = yellow, 1 = red     int activePlayer = 0;     boolean gameIsActive = true;     // 2 means unplayed     int[] gameState = {2, 2, 2, 2, 2, 2, 2, 2, 2};     int[][] winningPositions = {{0, 1, 2}, {3, 4, 5}, {6, 7, 8}, {0, 3, 6}, {1, 4, 7}, {2, 5, 8}, {0, 4, 8}, {2, 4, 6}};     /**      * ATTENTION: This was auto-generated to implement the App Indexing API.      * See https://g.co/AppIndexing/AndroidStudio for more information.      */     private GoogleApiClient client;     public void dropIn(View view) {         ImageView counter = (ImageView) view;         int tappedCounter = Integer.parseInt(counter.getTag().toString());         if (gameState[tappedCounter] == 2 && gameIsActive) {             gameState[tappe...

Latest Posts