Industriële fabricage
Industrieel internet der dingen | Industriële materialen | Onderhoud en reparatie van apparatuur | Industriële programmering |
home  MfgRobots >> Industriële fabricage >  >> Manufacturing Technology >> Productieproces

Arduino Due TIC TAC TOE met touchscreen

Componenten en benodigdheden

Arduino Due
× 1
2,8 zoll TFT LCD met touchscreen
× 1
Jumperdraden (algemeen)
× 1

Apps en online services

Arduino IDE

Over dit project

Over

Hallo, ik wil mijn werk aan het project van nickthegreek82 delen:arduino-touch-tic-tac-toe-game.

Je hebt nodig:

  • de Adafruit-bibliotheek
  • de GFX-bibliotheek
  • en de URTouch-bibliotheek

Bedrading

De bedrading voor het touchscreen is als volgt:

  • Touch -> Arduino Due
  • T_IRQ -> 22
  • T_DO -> 24
  • T_DIN -> 26
  • T_CS -> 28
  • T_CLK -> 30

Voor het display:

  • Weergave -> Arduino Due
  • SDO -> A.25
  • LED -> 3.3V
  • SCK -> A.27
  • SDI -> A.26
  • DC -> 9
  • RESET -> 8
  • CS -> 10
  • GND -> GND
  • VCC -> 3.3V

22.08.2017

De KI aangepast en wat code-optimalisatie.

26.08.2017

Enige code-optimalisatie.

27.08.2017

Kun je winnen van de CPU?

13.13.2018

een betere manier gevonden voor de A.I.

bedankt gaat naar klauscam https://github.com/klauscam/ArduinoTicTacToe

Code

  • TIC TAC TOE
  • TicTacToe_new
TIC TAC TOEArduino
Een eenvoudig TIC TAC TOE-spel om tegen de computer te spelen
 //////////////////////////////////// ///////// // 2.8" TOUCH SCREEN TIC TAC TOE // // // // http://www.educ8s.tv // // // // gewijzigd 08.2017 door rom3 // / ////////////////////////////////////////////#include #include #include #include #include #define TFT_RST 8#define TFT_DC 9#define TFT_CS 10#define TOUCH_ORIENTATION LANDSCAP93DAfruit_ILI93EAdafruit_ILI93EAdafruit_ILI93EAdafruit_ILI93EAdafruit_ILI9341 (TFT_CS, TFT_DC, TFT_RST);Adafruit_GFX_Button buttons[9];URTouch myTouch(30, 28, 26, 24, 22);unsigned short int moves =1; unsigned short int winnaar =0; //0 =Draw, 1 =Mens, 2 =CPUunsigned short int x,y; // positioneer touchunsigned short int cursor; // Cursor positionunsigned short int firstMoves[]={0,2,6,8}; // zal deze posities eerst gebruiken, als CPU begint met unsigned kort int-bord [] ={0,0,0,0,0,0,0,0,0};// bevat positiegegevens 0 is leeg, 1 mens, 2 is computerbool-speler; // true=YOU, false =CPUbo ol b=1; char start[10] ={"Gamestart"};char you[4] ={"YOU"};char cpu[4] ={"CPU"};char again[7] ={"Opnieuw?"}; const unsigned char circle[]PROGMEM={0b0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x ,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0 ,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x7,0xf8,0x0,0x ,0x0,0x0,0x0,0x0,0x7f,0xff,0x80,0x0,0x0,0x0,0x0,0x0,0x3,0xff,0xff,0xf0,0x0,0x0,0x0,0x0,0x0,0xf,0xf,0xf,0xf,0 ,0x0,0x0,0x0,0x0,0x0,0x1f,0xff,0xff,0xfe,0x0,0x0,0x0,0x0,0x0,0x7f,0xf0,0x3,0xff,0x80,0x0,0x0,0x0ff,0x0, ,0x0,0x7f,0xc0,0x0,0x0,0x0,0x1,0xfe,0x0,0x0,0x1f,0xe0,0x0,0x0,0x0,0x3,0xf8,0x0,0x0,0x7,0xf0,0x0,0x,0x0,0x ,0xf0,0x0,0x0,0x3,0xf8,0x0,0x0,0x0,0xf,0xe0,0x0,0x0,0x1,0xfc,0x0,0x0,0x0,0xf,0xc0,0x0,0x0,0x0,0xfc,0x0,0xfc,0x0,0xfc ,0x0,0x1f,0x80,0x0,0x0,0x0,0x7e,0x0,0x0,0x0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0x0,0x0,0x0,0x0,0x0,0x0,0x0 ,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0}; ongeldige setup() { myTouch.InitTouch(); myTouch.setPrecision(PREC_HI); tft.begin(); tft.setRotatie(3); tft.fillScreen(ILI9341_BLACK); // Teken wit frame tft.drawRect (0,0,320,240,ILI9341_WHITE); // Print "Arduino" tekst tft.setCursor (80,30); tft.setTextColor(ILI9341_GREEN); tft.setTextSize(4); tft.print("Arduino"); // Print "Tic Tac Toe"-tekst tft.setCursor (30.100); tft.setTextColor(ILI9341_WHITE); tft.setTextSize(4); tft.print("Tic Tac Toe"); // Rode knop maken // knoppen maken // x, y, w, h, omtrek-, vul-, tekstknoppen [0].initButton(&tft, 160,200,200,40,ILI9341_WHITE, ILI9341_RED, ILI9341_WHITE, start, 2); buttons[0].drawButton();do{ waitonetouch(&x,&y); if (knoppen[0].bevat(x,y)) b=0;}while(b>0); }void loop() { for(unsigned short int i=0;i<9;i++) { board[i]=0; } tft.fillScreen(ILI9341_BLACK); // Teken wit frame tft.drawRect (0,0,320,240,ILI9341_WHITE); // Print "Tic Tac Toe"-tekst tft.setCursor (30,30); tft.setTextColor(ILI9341_WHITE); tft.setTextSize(4); tft.print("Tic Tac Toe"); // "YouTube!" afdrukken tekst tft.setCursor (30.100); tft.setTextColor(ILI9341_GREEN); tft.setTextSize(4); tft.print("Wie begint"); //Maak rode knop // maak knoppen // x, y, w, h, outline, fill, text buttons [0].initButton(&tft, 100,200,80,40,ILI9341_WHITE, ILI9341_RED, ILI9341_WHITE, you, 2); knoppen[0].drawButton(); // knoppen maken // x, y, w, h, outline, fill, text buttons [1].initButton(&tft, 200,200,80,40,ILI9341_WHITE, ILI9341_RED, ILI9341_WHITE, cpu, 2); knoppen[1].drawButton(); b=1; do{ waitonetouch(&x,&y); if (knoppen[0].bevat(x,y)) { b=0; speler =1; tft.fillScreen(ILI9341_BLACK); // Teken wit frame tft.drawRect (0,0,320,240,ILI9341_WHITE); tft.setCursor(30,30); tft.setTextColor(ILI9341_WHITE); tft.setTextSize(2); tft.print("Ok, begin maar."); vertraging (2000); } if(knoppen[1].bevat(x,y)) { b=0; speler =0; tft.fillScreen(ILI9341_BLACK); // Teken wit frame tft.drawRect (0,0,320,240,ILI9341_WHITE); tft.setCursor(30,30); tft.setTextColor(ILI9341_WHITE); tft.setTextSize(2); tft.print("Ok, CPU begint."); vertraging (2000); } }terwijl(b>0); b=1; beweegt =1; winnaar =0; cursor =10; tft.fillScreen(ILI9341_BLACK); // Teken frame tft.drawRect (0,0,320,240,ILI9341_WHITE); //Teken verticale lijn tft.fillRect(80,15,5,205,ILI9341_WHITE); tft.fillRect(150,15,5,205,ILI9341_WHITE); //Draw horizontale lijn tft.fillRect (15,80,205,5,ILI9341_WHITE); tft.fillRect(15,150,205,5,ILI9341_WHITE); tft.drawRect(230,10,80,220,ILI9341_WHITE); { do { if(moves%2==1 &&player==false || moves%2==0 &&player==true) { cursor+=10; tft.setCursor(240,cursor); tft.setTextSize(1); tft.println("Ik teken"); arduinoMove(); checkWinner(); }anders { cursor+=10; tft.setCursor(240,cursor); tft.setTextSize(1); tft.println("Jouw zet"); spelerVerplaats(); checkWinner(); } vertraging (1000); beweegt++; }terwijl (winnaar==0 &&zet<10); waitonetouch(&x,&y); tft.fillScreen(ILI9341_BLACK); // Teken frame tft.drawRect (0,0,320,240,ILI9341_WHITE); // Print "Game Over"-tekst tft.setCursor (50,30); tft.setTextColor(ILI9341_WHITE); tft.setTextSize(4); tft.print("SPEL OVER"); if (winnaar ==0) { // Print "DRAW!" tekst tft.setCursor(110.100); tft.setTextColor(ILI9341_YELLOW); tft.setTextSize(4); tft.print("DRAW");} if(winnaar ==1){ //Print "HUMAN WINS!" tekst tft.setCursor(40.100); tft.setTextColor(ILI9341_BLUE); tft.setTextSize(4); tft.print("HUMAN WINS");} if(winner ==2){ //Print "CPU WINS!" tekst tft.setCursor(60.100); tft.setTextColor(ILI9341_RED); tft.setTextSize(4); tft.print("CPU WINS");} // maak knoppen // x, y, w, h, outline, fill, text buttons[0].initButton(&tft, 160,200,200,40,ILI9341_WHITE, ILI9341_RED, ILI9341_WHITE, nogmaals , 2); knoppen[0].drawButton(); do{ waitonetouch(&x,&y); if (knoppen[0].bevat(x,y)) b=0; }terwijl(b>0); }} void playerMove(){ waitonetouch(&x,&y); if((x>15 &&x<85) &&(y>15 &&y<85)) //0 { if(board[0]==0) { board[0]=1; tekenX(15,15); } anders fout(); } else if((x>85 &&x<155)&&(y>15 &&y<85)) //1 { if(board[1]==0) { board[1]=1; tekenX(85,15); } anders fout(); } if((x>155 &&x<225)&&(y>15 &&y<85)) //2 { if(board[2]==0) { board[2]=1; drawX(155,15); } anders fout(); } if((x>15 &&x<85)&&(y>85 &&y<155)) //3 { if(board[3]==0) { board[3]=1; tekenX(15,85); } anders fout(); } if((x>85 &&x<155)&&(y>85 &&y<155)) //4 { if(board[4]==0) { board[4]=1; tekenX(85,85); } anders fout(); } if((x>155 &&x<225)&&(y>85 &&y<155)) //5 { if(board[5]==0) { board[5]=1; tekenX(155,85); } anders fout(); } if((x>15 &&x<85)&&(y>155 &&y<225)) //6 { if(board[6]==0) { board[6]=1; drawX(15.155); } anders fout(); } if((x>85 &&x<155)&&(y>155 &&y<225)) //7 { if(board[7]==0) { board[7]=1; tekenX(85,155); } anders fout(); } if((x>155 &&x<225)&&(y>155 &&y<225)) //8 { if(board[8]==0) { board[8]=1; drawX(155,155); } anders fout(); }}ongeldige fout(){ cursor+=10; tft.setCursor(240,cursor); tft.setTextSize(1); tft.println("Fout"); vertraging (1000); cursor+=10; tft.setCursor(240,cursor); tft.println("Probeer het opnieuw."); playerMove();}unsigned short int checkOpponent(unsigned short int x, unsigned short int y){ if(board[1]==x &&board[2]==x &&board[0]==y){ if( y==0){ retourneer 0; } anders retourneer 1; } if(board[3]==x &&board[6]==x &&board[0]==y){ if(y==0){ return 0; } anders retourneer 6; } if(board[0]==y &&board[4]==x &&board[8]==x){ if(y==0){ return 0; } anders retourneer 8; } if(board[0]==x &&board[1]==y &&board[2]==x){ if(y==0){ return 1; } anders retourneer 0; } if(bord[4]==x &&bord[7]==x &&bord[1]==y){ if(y==0){ return 1; } anders retourneer 7; } if(board[0]==x &&board[1]==x &&board[2]==y){ if(y==0){ return 2; } anders retourneer 0; } if(bord[5]==x &&bord[8]==x &&bord[2]==y){ if(y==0){ return 2; } anders retourneer 8; } if(bord[4]==x &&bord[6]==x &&bord[2]==y){ if(y==0){ return 2; } anders retourneer 6; } if(bord[4]==x &&bord[5]==x &&bord[3]==y){ if(y==0){ return 3; } anders retourneer 5; } if(board[0]==x &&board[6]==x &&board[3]==y){ if(y==0){ return 3; } anders retourneer 6; } if(bord[3]==x &&bord[4]==y &&bord[5]==x){ if(y==0){ return 4; } anders retourneer 3; } if(bord[1]==x &&bord[7]==x &&bord[4]==y){ if(y==0){ return 4; } anders retourneer 1; } if(board[0]==x &&board[8]==x &&board[4]==y){ if(y==0){ return 4; } anders retourneer 0; } if(bord[2]==x &&bord[6]==x &&bord[4]==y){ if(y==0){ return 4; } anders retourneer 2; } if(bord[3]==x &&bord[4]==x &&bord[5]==y){ if(y==0){ return 5; } anders retourneer 3; } if(bord[2]==x &&bord[8]==x &&bord[5]==y){ if(y==0){ return 5; } anders retourneer 2; } if(bord[7]==x &&bord[8]==x &&bord[6]==y){ if(y==0){ return 6; } anders retourneer 8; } if(board[0]==x &&board[3]==x &&board[6]==y){ if(y==0){ return 6; } anders retourneer 0; } if(bord[4]==x &&bord[2]==x &&bord[6]==y){ if(y==0){ return 6; } anders retourneer 2; } if(bord[1]==x &&bord[4]==x &&bord[7]==y){ if(y==0){ return 7; } anders retourneer 1; } if(bord[6]==x &&bord[8]==x &&bord[7]==y){ if(y==0){ return 7; } anders retourneer 6; } if(bord[6]==x &&bord[7]==x &&bord[8]==y){ if(y==0){ return 8; } anders retourneer 6; } if(board[5]==x &&board[2]==x &&board[8]==y){ if(y==0){ return 8; } anders retourneer 2; } if(bord[4]==x &&bord[0]==x &&bord[8]==y){ if(y==0){ return 8; } anders retourneer 0; } else return 100;}void arduinoMove(){ if(moves<2) {do{ unsigned short int randomMove =random(4); unsigned short int c=firstMoves[randomMove]; if(bord[c]==0){ bord[c]=2; drawCpuMove(firstMoves[willekeurigeMove]); opbrengst; } }terwijl(beweegt<2); } if(beweegt<3) { if(bord[4]==0) {bord[4]=2; drawCpuMove(4); opbrengst; } } unsigned short int twoPlayer =checkOpponent(2,0);//CPU twee op een rij? if(twoPlayer <9) { board[twoPlayer]=2; drawCpuMove(tweeSpeler); opbrengst; } unsigned short int nextMove =checkOpponent(1,0);//Speler twee op een rij? if(nextMove <9) { board[nextMove]=2; drawCpuMove(nextMove); opbrengst; } unsigned short int next =checkOpponent(0,2); if (volgende <9) { bord [volgende]=2; drawCpuMove(volgende); opbrengst; } do { unsigned short int randomMove =random (9); if (bord[randomMove]==0) { board[randomMove]=2; drawCpuMove(willekeurige verplaatsing); opbrengst; } }while(nextMove ==100);} void drawCircle(unsigned short int x, unsigned short int y){ tft.drawBitmap(x,y,circle,65,65,ILI9341_RED);}void drawX(unsigned short int x , unsigned short int y){ tft.drawBitmap(x,y,x_bitmap,65,65,ILI9341_BLUE);}void drawCpuMove(unsigned short int move){ switch(move) { case 0:drawCircle (15,15); pauze; geval 1:drawCircle (85,15); pauze; geval 2:drawCircle (155,15); pauze; geval 3:drawCircle (15,85); pauze; geval 4:drawCircle (85,85); pauze; geval 5:drawCircle (155,85); pauze; geval 6:drawCircle (15.155); pauze; geval 7:drawCircle(85,155);break; geval 8:drawCircle(155,155);break; }}void checkWinner() // controleert het bord om te zien of er een winnaar is// plaatsen resultaat in de globale variabele 'winnaar'{ // nul gewonnen? if (bord[0]>0 &&bord[1]==bord[0] &&bord[2]==bord[0]) { winnaar=bord[0]; tft.fillRect (15, 45, 205, 5, ILI9341_WHITE); } if (bord[3]>0 &&bord[4]==bord[3] &&bord[5]==bord[3]) { winner=bord[3]; tft.fillRect (15, 115, 205, 5, ILI9341_WHITE); } if (bord[6]>0 &&bord[7]==bord[6] &&bord[8]==bord[6]) { winnaar=bord[6]; tft.fillRect(15, 185, 205, 5, ILI9341_WHITE); } if (bord[0]>0 &&bord[3]==bord[0] &&bord[6]==bord[0]) { winnaar=bord[0]; tft.fillRect(45, 15, 5, 205, ILI9341_WHITE); } if (bord[1]>0 &&bord[4]==bord[1] &&bord[7]==bord[1]) { winnaar=bord[1]; tft.fillRect(115, 15, 5, 205, ILI9341_WHITE); } if (bord[2]>0 &&bord[5]==bord[2] &&bord[8]==bord[2]) { winnaar=bord[2]; tft.fillRect(185, 15, 5, 205, ILI9341_WHITE); } if (bord[0]>0 &&bord[4]==bord[0] &&bord[8]==bord[0]) { winnaar=bord[0]; for(unsigned short int xx=0;xx<6;xx++){ tft.drawLine(20+xx, 20, 210+xx, 210, ILI9341_WHITE); } } if (bord[2]>0 &&bord[4]==bord[2] &&bord[6]==bord[2]) { winnaar=bord[2]; for(unsigned short int xx=0;xx<6;xx++){ tft.drawLine(210+xx, 20, 20+xx, 210, ILI9341_WHITE); } }} ongeldig waitonetouch (unsigned short int *x, unsigned short int *y){ do { delay(10); if (myTouch.dataAvailable() ==true) { myTouch.read(); *x =mijnTouch.getX(); //Krijg contactpunt *y =myTouch.getY(); opbrengst; } }terwijl(myTouch.dataAvailable()==false); }
TicTacToe_newArduino
Een onoverwinnelijke Tic Tac Toe single player op Arduino Due
 ///////////////////////////////////// //////// // 2.8" TOUCH SCREEN TIC TAC TOE // // // // http://www.educ8s.tv // // // // gewijzigd 08.2017 door rom3 // // ///////////////////////////////////////////#include  #include #include #include #define TFT_RST 8#define TFT_DC 9#define TFT_CS 10#define TOUCH_ORIENTATION LANDSCAPEAdafruit_ILI9341 tft =Adafruit_FT_ILI9341; [9];URTouch myTouch(30, 28, 26, 24, 22);char start[10] ={"Gamestart"};char you[4] ={"YOU"};char cpu[4] ={" CPU"};char again[7] ={"Nogmaals?"};int player;int moeilijkheid=8;unsigned short int x,y,b; // position touch#define BLACK 0x0000#define BLUE 0x001F#define RED 0xF800 #define GREEN 0x07E0#define CYAAN 0x07FF#define MAGENTA 0xF81F#define GEEL 0xFFE0#define WHITE 0xFFFFint bord[]={0,0,0,0,0,0,0,0,0};// houdt positiegegevens vast 0 is blanco, 1 mens, 2 is computerunsigned beurt;c onst unsigned char circle[]PROGMEM={0b0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0 ,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0 ,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x7,0xf8,0x0,0x ,0x0,0x0,0x0,0x0,0x7f,0xff,0x80,0x0,0x0,0x0,0x0,0x0,0x3,0xff,0xff,0xf0,0x0,0x0,0x0,0x0,0x0,0xf,0xf,0xf,0xf,0 ,0x0,0x0,0x0,0x0,0x0,0x1f,0xff,0xff,0xfe,0x0,0x0,0x0,0x0,0x0,0x7f,0xf0,0x3,0xff,0x80,0x0,0x0,0x0ff,0x0, ,0x0,0x7f,0xc0,0x0,0x0,0x0,0x1,0xfe,0x0,0x0,0x1f,0xe0,0x0,0x0,0x0,0x3,0xf8,0x0,0x0,0x7,0xf0,0x0,0x,0x0,0x ,0xf0,0x0,0x0,0x3,0xf8,0x0,0x0,0x0,0xf,0xe0,0x0,0x0,0x1,0xfc,0x0,0x0,0x0,0xf,0xc0,0x0,0x0,0x0,0xfc,0x0,0xfc,0x0,0xfc ,0x0,0x1f,0x80,0x0,0x0,0x0,0x7e,0x0,0x0,0x0,0x3f,0x0,0x0,0x0,0x0,0x3f,0x0,0x0,0x0,0x3e,0x0,0x0,0x0,0x0,0x0,0x0,0x ,0x0,0x0,0x0,0x7e,0x0,0x0,0x0,0x0,0x1f,0x80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instelling ongeldig (){myTouch.InitTouch(); myTouch.setPrecision(PREC_HI); tft.begin(); tft.setRotation(3);}void loop(){ int board[9] ={0,0,0,0,0,0,0,0,0}; drawStartScreen(); doe{ myTouch.read(); x =mijnTouch.getX(); //Get touch point y =myTouch.getY(); vertraging (100); }terwijl(!(knoppen[0].bevat(x,y))); tft.fillScreen(ZWART); // Teken wit frame tft.drawRect (0,0,320,240,WIT); // Print "Tic Tac Toe"-tekst tft.setCursor (30,30); tft.setTextColor(WIT); tft.setTextSize(4); tft.print("Tic Tac Toe"); // "YouTube!" afdrukken tekst tft.setCursor (30.100); tft.setTextColor(GROEN); tft.setTextSize(4); tft.print("Wie begint"); //Maak rode knop // maak knoppen // x, y, w, h, outline, fill, text buttons [0].initButton(&tft, 100,200,80,40,WHITE, RED, WHITE, you, 2); knoppen[0].drawButton(); // maak knoppen // x, y, w, h, outline, fill, text buttons [1].initButton(&tft, 200,200,80,40,WHITE, RED, WHITE, cpu, 2); knoppen[1].drawButton(); b=1; doe{ myTouch.read(); x =mijnTouch.getX(); //Get touch point y =myTouch.getY(); if (knoppen[0].bevat(x,y)) { b=0; speler =1; tft.fillScreen(ZWART); // Teken wit frame tft.drawRect (0,0,320,240,WIT); tft.setCursor(30,30); tft.setTextColor(WIT); tft.setTextSize(2); tft.print("Ok, begin maar."); vertraging (2000); } if(knoppen[1].bevat(x,y)) { b=0; speler =2; tft.fillScreen(ZWART); // Teken wit frame tft.drawRect (0,0,320,240,WIT); tft.setCursor(30,30); tft.setTextColor(WIT); tft.setTextSize(2); tft.print("Ok, CPU begint."); vertraging (2000); } }terwijl(b); tft.fillScreen(ZWART); tft.drawRect(0,0,319,240,WIT); drawVerticalLine(125); drawVerticalLine(195); drawHorizontalLine(80); drawHorizontalLine(150); for(turn =0; turn <9 &&win(board) ==0; ++turn) { if((turn+player) % 2 ==0) computerMove(board); anders { //teken(bord); spelerVerplaats(bord); } } switch(win(board)) { case 0:Serial.println("Het is gelijkspel.\n"); pauze; geval 1://teken(bord); Serial.println("Je verliest.\n"); pauze; case -1:Serial.println("Je wint!\n"); pauze; } do{}while(myTouch.dataAvailable()==false); //x =kaart (tp.y, 930, 88, 0, 480); //y =kaart (tp.x, 908, 125, 0, 320); // vertraging (250);} } ongeldige drawHorizontalLine (int y) {int i =0; for(i=0;i<7;i++) { tft.drawLine(60,y+i,270,y+i,WIT); }} ongeldig drawVerticalLine(int x){ int i=0; for(i=0;i<7;i++) { tft.drawLine(x+i,20,x+i,220,WIT); }} ongeldig drawStartScreen(){ tft.fillScreen(ZWART); // Teken wit frame tft.drawRect (0,0,319,240,WIT); // Print "Tic Tac Toe"-tekst tft.setCursor (30.100); tft.setTextColor(WIT); tft.setTextSize(4); tft.print("Tic Tac Toe"); // "YouTube!" afdrukken tekst tft.setCursor(80,30); tft.setTextColor(GROEN); tft.setTextSize(4); tft.print("Arduino"); buttons[0].initButton(&tft, 160,200,200,40,WIT, ROOD, WIT, start, 2); knoppen[0].drawButton(); }void drawCircle(int x, int y){ drawBitmap(x,y,circle,65,65,RED);}void drawX(int x, int y){ drawBitmap(x,y,x_bitmap,65,65,BLUE );}void drawBitmap(int16_t x, int16_t y, const uint8_t *bitmap, int16_t w, int16_t h, uint16_t kleur) { int16_t i, j, byteWidth =(w + 7) / 8; uint8_t-byte; for(j=0; j score) {score =tempScore; bewegen =ik; } } } //retourneert een score op basis van de minimax-boom op een bepaald knooppunt. bord [verplaatsen] =1; drawCpuMove(verplaatsen); delay(100);}void playerMove(int board[9]) {int move =0; b =1; do{ if (myTouch.dataAvailable() ==true) { myTouch.read(); x =mijnTouch.getX(); //Get touch point y =myTouch.getY(); if((x>55 &&x<125)&&(y>0 &&y<80)) //0 { if(board[0]==0) { move=0; b=0; } } else if((x>125 &&x<195) &&(y>0 &&y<80)) //1 { if(board[1]==0) { move=1; b=0; } } else if((x>195&&x<265)&&(y>0 &&y<80)) //2 { if(board[2]==0) { move=2; b=0; } } else if((x>55 &&x<125)&&(y>80 &&y<155)) //3 { if(board[3]==0) { move=3; b=0; } } else if((x>125 &&x<195)&&(y>80 &&y<155)) //4 { if(board[4]==0) { move=4; b=0; } } else if((x>195&&x<265)&&(y>80 &&y<155)) //5 { if(board[5]==0) { move=5; b=0; } } else if((x>55 &&x<125)&&(y>155 &&y<235)) //6 { if(board[6]==0) { move=6; b=0; } } else if((x>125 &&x<195)&&(y>155 &&y<235)) //7 { if(board[7]==0) { move=7; b=0; } } else if((x>195&&x<265)&&(y>155 &&y<235)) //8 { if(board[8]==0) { move=8; b=0; } } } }terwijl(b); bord [verplaatsen] =-1; drawPlayerMove(verplaatsen); delay(100);}int win(const int board[9]) { //lijst van mogelijke winnende posities unsigned wins[8][3] ={{0,1,2},{3,4,5}, {6,7,8},{0,3,6},{1,4,7},{2,5,8},{0,4,8},{2,4,6}}; int winPos; for(winPos =0; winPos <8; ++winPos) { if(board[wins[winPos][0]] !=0 &&board[wins[winPos][0]] ==board[wins[winPos][ 1]] &&board[wins[winPos][0]] ==board[wins[winPos][2]]) return board[wins[winPos][2]]; } return 0;}int minimax(int ​​board[9], int player, int depth) { //check de posities voor spelers int winner =win(board); if(winnaar !=0) retourneer winnaar*speler; int zet =-1; int-score =-2; int ik; for(i =0; i <9; ++i) { if(bord[i] ==0) { bord[i] =speler; int thisScore=0; if (diepte score) {score =thisScore; bewegen =ik; } // kies de slechtste zet voor het bord van de tegenstander [i] =0; } } if(move ==-1) retourneer 0; return score;} ongeldig drawCpuMove (int move) { switch (move) { case 0:drawCircle (55,15); pauze; geval 1:drawCircle (130,15); pauze; geval 2:drawCircle(205,15); pauze; geval 3:drawCircle (55,85); pauze; geval 4:drawCircle (130,85); pauze; geval 5:drawCircle(205,85); pauze; geval 6:drawCircle (55,155); pauze; geval 7:drawCircle(130,155);break; geval 8:drawCircle(205,155);break; }} ongeldig drawPlayerMove(int move){ switch(move) { case 0:drawX(55,15); pauze; geval 1:drawX(130,15); pauze; geval 2:drawX(205,15); pauze; geval 3:drawX(55,85); pauze; geval 4:drawX(130,85); pauze; geval 5:drawX(205,85); pauze; geval 6:drawX(55.155); pauze; geval 7:drawX(130,155);break; geval 8:drawX(205,155);break; }}

Schema's

Bedrading

Productieproces

  1. Tic Tac Toe-spelvisitekaartje
  2. CO2-monitoring met K30-sensor
  3. Doofblinde communicatie met 1Sheeld/Arduino
  4. Bedien muntvangers met Arduino
  5. Arduino met Bluetooth om een ​​LED te bedienen!
  6. Capacitieve vingerafdruksensor met een Arduino of ESP8266
  7. Spelen met Nextion Display
  8. Nunchuk-gestuurde robotarm (met Arduino)
  9. Zonnestraling meten met Arduino
  10. Mini-radar met Arduino
  11. Muziek maken met een Arduino