Pervasive Displays Library Suite - Basic edition 8.0.1
Library for Pervasive Displays e-paper screens and EXT3 extension board
Loading...
Searching...
No Matches
Basic_Touch_TicTacToe.ino File Reference

Example of features for basic edition. More...

Include dependency graph for Basic_Touch_TicTacToe.ino:

Data Structures

struct  coordinates_s
 

Macros

#define PLAYER_NONE   0
 
#define PLAYER_HUMAN   1
 
#define PLAYER_MCU   2
 
#define NUMBER   4
 

Functions

bool checkWinnerPlayer (uint8_t player)
 Check whether palyer is winner.
 
void drawWinnerPlayer (uint8_t player)
 Draw winning line, column or diagonal.
 
uint8_t checkWinner ()
 Check the winner.
 
void drawMovePlayer (coordinates_s coordinates, uint8_t player)
 Display the move of player.
 
void moveMCU ()
 Let the MCU play.
 
bool checkHuman (coordinates_s &coordinates)
 Check human play.
 
void printBoard ()
 Print board on serial.
 
void playGame ()
 Play the game.
 
void moveHuman ()
 Let the human play.
 
void resetGame ()
 Reset the game.
 
void drawStartScreen ()
 Draw start screen.
 
void drawGameScreen ()
 Draw empty board.
 
void drawGameOverScreen ()
 Draw end of game.
 
uint8_t getBoard (coordinates_s coordinates)
 Get board cell content.
 
bool setBoard (coordinates_s coordinates, uint8_t player)
 Set board cell content to player.
 
void displayCenteredText (uint16_t x0, uint16_t y0, String text, uint16_t colour)
 Display text centered on coordinates.
 
void setup ()
 Setup.
 
void loop ()
 Loop, empty.
 

Variables

Screen_EPD_EXT3_Fast myScreen (eScreen_EPD_370_PS_0C_Touch, boardRaspberryPiPico_RP2040)
 
uint16_t x
 
uint16_t y
 
uint16_t dx
 
uint16_t dy
 
coordinates_s coordinates
 
uint16_t tx
 
uint16_t ty
 
uint16_t tz
 
uint16_t tt
 
uint16_t colourHuman
 
uint16_t colourMCU
 
uint16_t colourGrid
 
uint16_t colourBackground
 
uint16_t colourMessage
 
uint8_t fsmScreen = 1
 
uint8_t moves = 1
 
uint8_t winner = 0
 
uint8_t board [4][4]
 
uint16_t minX
 
uint16_t maxX
 
uint16_t minY
 
uint16_t maxY
 
uint16_t sizeTable
 
uint16_t sizeCell
 

Detailed Description

Example of features for basic edition.

Library for Pervasive Displays EXT3 - Basic level

Author
Rei Vilo
Date
21 Mar 2024
Version
801
See also
ReadMe.txt for references

Function Documentation

◆ checkHuman()

bool checkHuman ( coordinates_s & coordinates)

Check human play.

Parameters
coordinatescoordinates of the cell to block
Returns
true if cell identified, false otherwise

◆ checkWinner()

uint8_t checkWinner ( )

Check the winner.

Returns
winner player number, 0 if none

◆ checkWinnerPlayer()

bool checkWinnerPlayer ( uint8_t player)

Check whether palyer is winner.

Parameters
playerplayer number
Returns
true if winner, false otherwise

◆ displayCenteredText()

void displayCenteredText ( uint16_t x0,
uint16_t y0,
String text,
uint16_t colour )

Display text centered on coordinates.

Parameters
x0x coordinate
y0y coordinate
texttext
colourcolour

◆ drawMovePlayer()

void drawMovePlayer ( coordinates_s coordinates,
uint8_t player )

Display the move of player.

Parameters
coordinatesmove coordinates
playerplayer number

◆ drawWinnerPlayer()

void drawWinnerPlayer ( uint8_t player)

Draw winning line, column or diagonal.

Parameters
playerplayer number

◆ getBoard()

uint8_t getBoard ( coordinates_s coordinates)

Get board cell content.

Parameters
coordinatescoordinates i j of cell
Returns
player number

◆ setBoard()

bool setBoard ( coordinates_s coordinates,
uint8_t player )

Set board cell content to player.

Parameters
coordinatescoordinates i j of cell
playerplayer number
Returns
true is cell updated, false otherwise
Note
Targeted cell should be empty