tic tac toe game [英] tic tac toe game

查看:65
本文介绍了tic tac toe game的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

确定。救命。本季度即将结束,我没有兴趣制作

游戏。我认为这就是为什么我在这个特定的实验室里有一个精神障碍

任务。


我和Steven Smith使用的是同一本书使用当一个男人帮助

他时。


而且,我甚至不知道从哪里继续。


该应用程序是一个tic tac toe游戏。

我认为我需要一个用户定义的集合。

我为所有标签编码游戏中使用的游戏。


每次游戏第一次出现时,O是董事会上的第一个标志。


我想我需要在X之间切换的东西。和O每次点击

标签。


我得到了新的游戏按钮编码,以便在

时清除游戏方块单击新的游戏按钮。


现在我该怎么办?

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?

推荐答案

首先,tic tac toe总是以X开头,而不是O。要在X和O之间切换

,你可以尝试使用静态变量。

Private Sub lblBox_Click(...)

静态IsX as boolean


IsX = Not IsX

如果LblBox(i).Text =""然后

如果IsX那么

lblBox(i).Text =" X"

Else

lblBox( i).Text =" O>

结束如果

结束如果


''代码来分析你是否有三个连续。


End Sub


自从我使用控件集合已经有几年了,所以你需要

调整它以适应点击集合中的哪个标签。如果

标签不在集合中,那么静态声明需要将

移到子表单之外的表单声明中。您将需要编写代码

来分析每行中是否连续3行,每列向下,以及每个对角线的X和Os
。您可以使用If语句。 HTH


Kim

" Valerie" < VA **** @ earthlink.net>在消息中写道

新闻:2O ******************* @ newsread2.news.atl.eart hlink.net ...
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****@earthlink.net> wrote in message
news:2O*******************@newsread2.news.atl.eart hlink.net...
好的。救命。本季度即将结束,我没有兴趣制作游戏。我认为这就是为什么我在这个特定的实验室里有心理障碍的工作。

我正在使用Steven Smith所使用的同一本书当One Handed Man
帮助了他。

而且,我甚至都不知道从哪里继续。

该应用程序是一个tic tac toe游戏。
我认为我我需要一个用户定义的集合。
我为游戏中使用的所有标签编码。

每次游戏第一次出现时,O是我们的第一个标志。

我想我需要在X之间切换的东西。和O每次点击
标签。

我得到了新的游戏按钮编码,以便在点击新游戏按钮时清除游戏方块。

现在该怎么办?
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?



实际上,我更有可能使用二维数组来实现这个目的>
类似的东西,我认为这有助于你在设计/编码过程中的思考,因为

你可以像你看到的那样代表它。


-

问候 - 一个垂头丧气的男人


作者:Fish .NET&保持.NET

======================================= ==

此帖子按原样提供。没有保证,

并且不授予任何权利。

Valerie < VA **** @ earthlink.net>在消息中写道

新闻:2O ******************* @ newsread2.news.atl.eart hlink.net ...
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****@earthlink.net> wrote in message
news:2O*******************@newsread2.news.atl.eart hlink.net...
好的。救命。本季度即将结束,我没有兴趣制作游戏。我认为这就是为什么我在这个特定的实验室里有心理障碍的工作。

我正在使用Steven Smith所使用的同一本书当One Handed Man
帮助了他。

而且,我甚至都不知道从哪里继续。

该应用程序是一个tic tac toe游戏。
我认为我我需要一个用户定义的集合。
我为游戏中使用的所有标签编码。

每次游戏第一次出现时,O是我们的第一个标志。

我想我需要在X之间切换的东西。和O每次点击
标签。

我得到了新的游戏按钮编码,以便在点击新游戏按钮时清除游戏方块。

现在我该怎么做?
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?



您好

Google搜索Tic Tac VB"你找到了很多。


这是我的谷歌搜索中的一个。

我没试过,我看到它使用了一个带有9个项目的arraylist 。
http://www.vbdotnetheaven.com/Code /Jun2003/2062.asp

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


这篇关于tic tac toe game的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆