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

Arduino - Have Fun with Color Sensor
Easy
  • 208
  • 9

Full instructions

This project shows how to change color of Minion using Arduino, PHPoC WiFi Shield and color sensor.

Arduino - Web-Based Thermometer
Easy
  • 499
  • 11

Full instructions

This project allows you to check temperature at home from anywhere using web browser.

Electronic Voting Machine Using Arduino
Easy
  • 136
  • 5

It is an EVM using Arduino. There are five switches in all, assigned for various activities.

Using Python and Arduino MKR1000 for Secure IoT
Easy
  • 522
  • 7

Full instructions

Getting started with Python and Arduino MKR1000 for secure IoT projects.

Retro Nokia Snake Game with Arduino
Easy
  • 3,039
  • 23

Full instructions

Ever wish you could go back to the happy 90's and play snake on your old Nokia phone? Grab on to your joystick for this blast-from-the-past.

Play Music With Your Remote
Easy
  • 587
  • 5

Full instructions

Choose a song with your remote and Arduino will play it. On the monitor will appear the musical note played.

ProjectsCommunitiesTopicsContestsLiveAppsBetaFree StoreBlogAdd projectSign up / Login