Tic Tac Toe

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

Tic Tac Toe

ashort
I have written a tic tac toe game in Jack.  

You can choose to be player X or player O.

It has 3 levels of play:

(1) easy - the computer plays randomly
(2) medium - the computer can only see 2 moves ahead, thus is beatable
(3) expert - the computer will never lose.  If you play correctly, you will tie at best.

You can download the .vm code here and run it in the VM Emulator and play around with it.  

I am also happy to post the full Jack source, but I'm guessing since this is such a common project, maybe not. I will only do so if WBahn, the administrator, says it's ok.

Also, if anyone is struggling to make a tic tac toe game, I'm happy to answer any questions.

Here are some screenshots:





Reply | Threaded
Open this post in threaded view
|

Re: Tic Tac Toe

Lozminda
I love expert level, you'll never win !!
Reply | Threaded
Open this post in threaded view
|

Re: Tic Tac Toe

nooreldeensalah
In reply to this post by ashort
Nice work, How did you draw the X's and the Y's though?
Do you mind giving advice?
Reply | Threaded
Open this post in threaded view
|

Re: Tic Tac Toe

ashort
I drew the X's using the Jack OS Screen.drawLine function.

I drew the O's using the Jack OS Screen.drawCircle function.  

Note that drawCircle draws a FILLED circle of the current color, so I drew a filled black circle, then I drew a smaller filled white circle inside of it.  I could have written my own routine to draw an unfilled circle, but I was too lazy and it was trivial to do it the way I did.

Reply | Threaded
Open this post in threaded view
|

Re: Tic Tac Toe

nooreldeensalah
Aha that works well.
Thank you!