Example Code

Joshua - The Tris

Products and Environment

This section reflects the products and operating system used to create the example.

To download NI software, including the products shown below, visit ni.com/downloads.

    Software

  • LabVIEW

    Operating System

  • Android
  • Windows

Code and Documents

Attachment

Description

Applicazione che simula il gioco del tris. Sono disponibili tre livelli di difficoltà: "Easy", "Medium" e "Hard", che corrispondono a tre differenti strategie di gioco del computer. In particolare a livello "Hard", Joshua, in onore al celeberrimo film "War Games" del 1983, attua una strategia "minimax". Si gioca premendo i tasti di una pulsantiera. Il pulsante di "Restart" e il tasto "r" permettono di riavviare il gioco mentre il pulsante "Computer Vs Computer" consente a Joshua di fare una mossa al posto del giocatore seguendo la strategia di gioco impostata. Inizia lo "zero" e si può giocare anche in due. In allegato vengono inoltre riportate altre due versioni di questo gioco: una versione Java per PC e una per smartphone Android.

 

 

tris.jpg

 

 

 

 

Example code from the Example Code Exchange in the NI Community is licensed with the MIT license.

Comments
Larry.C
Active Participant
Active Participant
on

Thanks for posting a fun game, maybe in future it would be nice to learn something from it by looking at the block diagram, unfortunately this one is locked


Larry Colvin
Associate Principal Engineer
Dyson Technology Ltd.

Ing._Claudio_Fontana
Member
Member
on

Hi Mr Larry. C,

I'm sorry for the protection but I made this project for students to explain the theory underlying the game and how to implement it. In the future I'll write something more about It. For the moment you can identify the states of the state machine I used in the game looking at the .ctl files. In addition, looking at the move_gen(SubVI) VI, you'll realize that while you play the game the computer reads a table containing all the possible game configuration and some other usefull informations.

Contributors