# O and X's or tic tac toe

**URL:** https://forum.kirupa.com/t/o-and-xs-or-tic-tac-toe/52277
**Category:** programming
**Created:** [May 21, 2004, 7:13pm UTC](https://forum.kirupa.com/t/o-and-xs-or-tic-tac-toe/52277 "2004-05-21T19:13:20Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![yhack](https://avatars.discourse-cdn.com/v4/letter/y/3da27b/32.png) [@yhack](https://forum.kirupa.com/u/yhack)
#### Post date: [May 21, 2004, 7:13pm UTC](https://forum.kirupa.com/t/o-and-xs-or-tic-tac-toe/52277/1 "2004-05-21T19:13:20Z")

</div>

How could i make ai for a noughts and crosses or tic tac toe game  
so it would look like this

* * *

|_|_|_|  
|_|_|_|  
|_|_|\_|

when u click the box it turns to a circle.  
then the “computer player” has a turn but how can i make it so the computer player makes his move blocking the “player 1’s” circles?

and could i make it so if 3 are in a line then player 1 wins

thanks in advance,  
yhack
