Jump to content
  • Advertisement
Sign in to follow this  
  • entries
  • comments
  • views

Tic Tac Toe

Sign in to follow this  


download here.

[journal dump]

ok, so Drakkcon made a tic tac toe game in c# and by the gods! its 5megs big and the code is just awful. time for another "code by the seat of my pants" session!

ok, we're going to do a few things differently than him. for one, i'm going to make a 3x3 array of labels. we'll make one and copy it 8 times, arranging them around the single one. lets start with that. [working]

hmm. making a copy of an object isn't as easy as i want. i want to clone it, but i can't remember.. [working] nope, i had to manually do it. oh well. lets see if it works [working] oops, i forgot to Controls.Add() the labels ^_^ [working]

yeah ok now it works right. i also added a Click event handler for each one that actually uses the same function for every one. right now i've got it changing the text from X to O every click. next i'm going to put in the actual game. [working]

ok the game's all but done. the only (big) problem now is that there's no tie situation test. because of that, and the computer's (stupid) AI, when it gets to a tie and all spaces are taken, the game locks up tight. how do i fix that? well, first i should be checking for a tie - if all spaces are taken and we haven't announced a win, then we have to have a tie. we need to check for a tie before we let the computer run its AI, because its set to just look forever until it randomly finds an empty spot. that would finish things off. [working]

jenn just suggested we let the game track your name so it says it to you in the win message. that's easy. but, how do we want to get the name to start with? the simplest thing i can think of is to just have a textbox right on the game that has your name in it and you can click on it to change it any time you want. [talking]

thats in now. now the last thing i see that he has is that you can choose whether you're X or O. when you choose a different one, you reset the board and thats that. personally i don't think you should have the option to change betwen X and O, because the player could get up and then sit back down at the game 5min later and wonder whether they were X or O. if the player is always X, there's no confusion. i suppose a way to alleviate that problem would be to tell the player whether they were X or O by the player's name. that works well enough for me.

i don't like how he has two buttons at the bottom that let you choose X or O, its cludgy and doesn't seem like the bestest way to go about it. i'm thinking that adding a new menu item 'New Game' and then two subitems 'As X' and 'As O' would work better. [working] yeah, its good that way. building a new version and uploading. oops, its 5.31 KB (5,441 bytes) big, zipped. Drakkcon: What's next? [grin]
Sign in to follow this  


Recommended Comments

hey, thanks for the suggestion. if the guy had any idea how to use proper grammar, i'd think about it - but then i'm not using c++ either. also, i already have a working visual studio (express beta) so i'm doing fine. i'd hate to waste my luck on something useless.

Share this comment

Link to comment
How nice of you to insult a 14-year-old's first game ever. Whatever, no hard feelings :). I will try your ideas and improve it. It's 5mb unzipped because I wasn't able to compress it any with my trial version of WinRAR, it probably would be around 1mb. I zipped it up because GameDev file hosting won't let me use .exe files. I also have no idea how to make it smaller, it would probably be alot smaller when done in C++ (which I also know).
The code is bad because I tought myself C# by experimentation and MSDN dox, and I learned it for one day before making this Tic Tac Toe thing (I was using C++ before), and this is my first experience with .net ever.

PS: I stick by my two X O button method, I like it better :)

PPS: I would like to see your code.

Share this comment

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!