473,803 Members | 4,392 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

tic tac toe game

Ok. Help. the quarter is ending soon and I have no interest in creating
games. I think that's why i have a mental block on this particular lab
assignment.

I'm using the same book as Steven Smith is using when One Handed Man helped
him.

And, I don't even know where to continue.

The application is a tic tac toe game.
I figure that i'll need a user-defined collection.
I coded it for all of the labels used in the game.

every time the game first comes up, "O" is the first mark on the board.

I think i need something that switches between "X" and "O" every time a
label is clicked.

I got the new game button coded so that the game squares are cleared when
the new game button is clicked.

Now what do I do?
Nov 20 '05 #1
17 4580
First off, tic tac toe always starts with the "X", not the "O". To switch
between X and O, you could try using a static variable.
Private Sub lblBox_Click(.. .)
Static IsX as boolean

IsX = Not IsX
If LblBox(i).Text= "" then
If IsX then
lblBox(i).Text= "X"
Else
lblBox(i).Text= "O"
End if
End If

' Code to analyze whether you have three in a row.

End Sub

It has been a few years since I used a control collection, so you will need
to adjust it to accomodate which label in the collection is clicked. If the
labels are not in the collection then the Static declaration needs to be
moved outside the sub to the form declarations. You will need to write code
to analyze if you have 3 in a row accross each row, down each column and
along each diagonal for Xs and Os. You can use If statements for this. HTH

Kim
"Valerie" <va****@earthli nk.net> wrote in message
news:2O******** ***********@new sread2.news.atl .earthlink.net. ..
Ok. Help. the quarter is ending soon and I have no interest in creating
games. I think that's why i have a mental block on this particular lab
assignment.

I'm using the same book as Steven Smith is using when One Handed Man helped him.

And, I don't even know where to continue.

The application is a tic tac toe game.
I figure that i'll need a user-defined collection.
I coded it for all of the labels used in the game.

every time the game first comes up, "O" is the first mark on the board.

I think i need something that switches between "X" and "O" every time a
label is clicked.

I got the new game button coded so that the game squares are cleared when
the new game button is clicked.

Now what do I do?

Nov 20 '05 #2
Actually, I would be more likely to use a two dimensional array for this
kind of thing, I think it helps your thinking during design/coding because
you can represent it as you would see it.

--
Regards - One Handed Man

Author : Fish .NET & Keep .NET
=============== =============== ===========
This posting is provided "AS IS" with no warranties,
and confers no rights.
"Valerie" <va****@earthli nk.net> wrote in message
news:2O******** ***********@new sread2.news.atl .earthlink.net. ..
Ok. Help. the quarter is ending soon and I have no interest in creating
games. I think that's why i have a mental block on this particular lab
assignment.

I'm using the same book as Steven Smith is using when One Handed Man helped him.

And, I don't even know where to continue.

The application is a tic tac toe game.
I figure that i'll need a user-defined collection.
I coded it for all of the labels used in the game.

every time the game first comes up, "O" is the first mark on the board.

I think i need something that switches between "X" and "O" every time a
label is clicked.

I got the new game button coded so that the game squares are cleared when
the new game button is clicked.

Now what do I do?

Nov 20 '05 #3
Cor
Hi
Do a Google search on "Tic Tac VB" you find a lot of them.

This is one from my Google search.
I did not try it, I saw it uses an arraylist with 9 items.
http://www.vbdotnetheaven.com/Code/Jun2003/2062.asp
Cor
Nov 20 '05 #4
Cor
Hi One handed man,
Sorry I did write this in this threath after yours.
I did read it and thought has this really to be (3)(3).
Than I was making some arguments why that was not necessary.
Than I did think why argue about that, you can think about the educative
purpose of it.
I thought why not give a link to Google.
I found one and it was with a arraylist with one dimension.
And then I did post it on the wrong place.
Sorry
"Cor"
Nov 20 '05 #5
I guess it comes down to personal choice. It is just as valid to use a
single dimension as two dimensions. In my head though, I find it easier to
use two dimensions when representing a two dimensional object, after all
tic tac toe is two dimensional ( actually two on screen ).

I wrote a star trek game some time ago mapping out the iniverse and
galaxies, i did this in that format so I suppose I got used to mapping it
that way.

Anyhow, i hope all this helps the poster of the original question.

--
Regards - One Handed Man

Author : Fish .NET & Keep .NET
=============== =============== ===========
This posting is provided "AS IS" with no warranties,
and confers no rights.
"Cor" <no*@non.com> wrote in message
news:3f******** *************** @reader20.wxs.n l...
Hi One handed man,
Sorry I did write this in this threath after yours.
I did read it and thought has this really to be (3)(3).
Than I was making some arguments why that was not necessary.
Than I did think why argue about that, you can think about the educative
purpose of it.
I thought why not give a link to Google.
I found one and it was with a arraylist with one dimension.
And then I did post it on the wrong place.
Sorry
"Cor"

Nov 20 '05 #6
Hi One Handed Man,

Two dimensions for Star Trek? How did you code all those Temporal
Anomalies and Sub-space Phase Shifts? Lol.

Regards,
Fergus
Nov 20 '05 #7
-----Original Message-----
Hi One Handed Man,

Two dimensions for Star Trek? How did you code all those TemporalAnomalies and Sub-space Phase Shifts? Lol.

LOL nuff said... :)
Nov 20 '05 #8
Hi One Handed Man,

|| > Two dimensions for Star Trek?
|| > How did you code all those Temporal
|| > Anomalies and Sub-space Phase Shifts? Lol.
||
|| Easy, I just attached my cerebral cortex to the USB
|| port. Once I had bound my multi-phasing torpedo
|| to Seven-of-Nine's worm hole, I guess time stood
|| still, and thats the anomaly.

ROFL

What an energy configuration!!
Time stood still, but the Universe moved.

Yours, jealously,
Fergus
Nov 20 '05 #9
Hi Steven, Valerie

Except that instead of a RadioButton you'll be using a whose-turn-is-it
variable?

Regards,
Fergus
Nov 20 '05 #10

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

138
6612
by: theodp | last post by:
--> From http://www.techdirt.com/articles/20040406/1349225.shtml Microsoft Patents Saving The Name Of A Game Contributed by Mike on Tuesday, April 6th, 2004 @ 01:49PM from the yeah,-that's-non-obvious dept. theodp writes "As if there weren't enough dodgy patents, here's an excerpt from one granted to Microsoft Tuesday for a 'Method and apparatus for displaying information regarding stored data in a gaming system': 'When saving a game,...
7
7068
by: Brandon J. Van Every | last post by:
Anyone know of any "good" open source C# game projects out there? Something that actually has a game engine and some content done, so I can just fiddle with it and do interesting / goofy things. I hesitate to state genre preferences. I've been all over SourceForge and it's slim pickings in C# land, at least for projects that have actually gotten something done. I'll be doing my last round of sifting and searching tonight, then I'm...
1
3701
by: Jerry Fleming | last post by:
Hi, I have wrote a game with python curses. The problem is that I want to confirm before quitting, while my implementation doesn't seem to work. Anyone can help me? #!/usr/bin/python # # Brick & Ball in Python # by Jerry Fleming <jerryfleming@etang.com>
1
2892
by: fowle040 | last post by:
I underlined and bold print my files. I need to know how to make this code into a working game. The object of the game is to have two players 1- belle and 2-beast. I want them to lose and gain strength and health, when 0 die. I need to know how to make them interact. I need to know what to do with teraform (creek, pasture, brick road) how to add. I need the public interface to look like the forest. classes need to function the program...
7
2860
by: Gasten | last post by:
Hello. The last weeks I've been coding a roguelike (you know, like nethack) in python using the nCurses library. Some week ago I ran into a problem: When I made the object for messagebar-output, I found a bug that I can't figure out (believe me; I've tried everything and asked for help several times on the IRC-channel). The updateMsg() and iMsg() takes a list of message-lines as argument (or process a string to a list), and it'll output...
5
8939
by: Kraken | last post by:
Hi, i have a bit of a problem here. I have an assignment to do an animal guessing game using an original database and updating it as the user enters new animals in it. The program enters the file data into an array of structures, with the animal and question in the same variable(question) and the bool isAnimal tells me whether its an animal or a question. If its a question it is followed by two numbers; one for the position of the line to go...
5
4586
by: alesitaam | last post by:
Help!!!! Im new using python, currently writing a program which tests one game, IQ test. When the module is run, the program should ask user to choose the game to start. Also, I'm using Try...Except statements, and os file operator. My code needs some adjustments, most of all at the end. Please give some tips!!! import os while True: print"Welcome to trivia game!" print "0-Choose a game to play:" print "1- IQ Test.trv"
2
5318
by: LilMeechc20 | last post by:
Hello, I have a group assignment that I have to do. We have to write a Tic Tac Toe game. One person in my group has managed to write the code for a multiplayer (human -vs- human) game and I managed to write a code for a single player (human -vs- computer) game. My problem is, now we want to merge the two games with options to pick which game you would like to play. However, the games were written totally different styles and I can't...
0
9562
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10309
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10289
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9119
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7600
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6840
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5496
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
4274
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2968
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.