Things used in this project

Code

Code snippet #1Plain text
<p>int firstMoves[]={0,2,6,8}; // will use these positions first</p><p>  for(counter=0;counter<4;counter++) //Count first moves played
  {
    if(board[firstMoves[counter]]!=0) // First move is played by someone
    {
      movesPlayed++;
    }
  }  
  do{
    if(moves<=2)
    {
      int randomMove =random(4); 
      int c=firstMoves[randomMove];
      
      if (board[c]==0)
      {  
        delay(1000);
        board[c]=2;
        Serial.print(firstMoves[randomMove]);
        Serial.println();
        drawCpuMove(firstMoves[randomMove]);
        b=1;
      }   
        
    }</p>
Code snippet #2Plain text
<p>int checkOpponent()<br>{
  if(board[0]==1 && board[1]==1 && board[2]==0)
  return 2;
  else if(board[0]==1 && board[1]==0 && board[2]==1)
  return 1;
  else if (board[1]==1 && board [2]==1 && board[0]==0)
  return 0;
  else if (board[3]==1 && board[4]==1 && board[5]==0)
  return 5;
  else if (board[4]==1 && board[5]==1&& board[3]==0)
  return 3;
  else if (board[3]==1 && board[4]==0&& board[5]==1)
  return 4;
  else if (board[1]==0 && board[4]==1&& board[7]==1)
  return 1;
  else
  return 100;
}</p>
Github
https://github.com/adafruit/Adafruit-GFX-Library
Github
https://github.com/adafruit/Touch-Screen-Library

Credits

Photo
Nick Koumaris

My name is Nick Koumaris and I am a software engineer from Sparta, Greece. I love building projects and share them with the world!

Contact

Replications

Did you replicate this project? Share it!

I made one

Love this project? Think it could be improved? Tell us what you think!

Give feedback

Comments

Similar projects you might like

Using CA and CC RGB LED by Current Sourcing and Sinking!
Easy
  • 618
  • 48

Protip

RGB LEDs are of two types, common cathode and common anode which behave differently with same Arduino code; how to resolve this.

Break your heart - The Arduino ON LED blinking
Easy
  • 16
  • 1

Full instructions

This is the project who don't know about Arduino and Arduino IDE yet. Now, break it!!!

Arduino Amiga Floppy Disk Reader
Easy
  • 6,101
  • 9

Work in progress

An Arduino powered floppy disk controller and reader for making disk images from old AmigaDOS floppy disks.

MKR FOX 1200 Movement Trigger
Easy
  • 1,076
  • 3

Full instructions

Use your MKR FOX 1200 as a movement trigger to keep an eye on your belongings.

How to use the accelerometer- gyroscope GY-521
Easy
  • 367
  • 2

Full instructions

Find out how the world turns. Read the values of the accelerometer and the gyroscope.

Simple Dark Sensor
Easy
  • 110
  • 2

A simple dark sensor with or without Arduino.

Sign up / LoginProjectsCommunitiesTopicsContestsLiveAppsBetaFree StoreBlog