Win a copy of Zero to AI - A non-technical, hype-free guide to prospering in the AI era this week in the Artificial Intelligence and Machine Learning forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Paul Clapham
  • Bear Bibeault
  • Jeanne Boyarsky
Sheriffs:
  • Ron McLeod
  • Tim Cooke
  • Devaka Cooray
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Jj Roberts
  • Stephan van Hulst
  • Carey Brown
Bartenders:
  • salvin francis
  • Scott Selikoff
  • fred rosenberger

TicTacToe Game

 
Ranch Hand
Posts: 31
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
OK, Heres the deal. I have my program able to play tictactoe. (Switch turns, Write in the "X" or "O" on the square you pick, and disable the player from picking an already picked square.)

All, I need to do now is make a winning procedure. Now I know I did this before ..(in pascal), but Everytime I write something its not even close to working.

I think you can create some sort of loop the checks one square foe a value and then have it check x+1 for the next square Can anyone give me a hint? If I can dig up that pascal program maybe I can just use that as a model. Thanks.


[ December 08, 2006: Message edited by: doburomirushii nikku ]
 
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If you go to www.gamedevelopersclub.org, click on Tutorials, there is a tic-tac-toe tutorial on there. It's written in C for the GBA, but the win function is nothing but an if statement. Not very elegant, but it does get the job done, hope it helps.
 
doburomirushii nikku
Ranch Hand
Posts: 31
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ya, thanks. That is exactly what I wanted! I was kinda lookin for it in a loop so I could do 5x5 tic tac toe easier when im done with 3x3. But 3x3 is done so thanks!
 
Ranch Hand
Posts: 125
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Here's one I wrote in JavaScript:
http://ostermiller.org/calc/tictactoe.html
 
My, my, aren't you a big fella. Here, have a tiny ad:
the value of filler advertising in 2020
https://coderanch.com/t/730886/filler-advertising
reply
    Bookmark Topic Watch Topic
  • New Topic