| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 354 人关注过本帖
标题:求助:有个关于"游戏的玩法 "的程序考试题,如何编写?谢谢
只看楼主 加入收藏
ftyy
Rank: 1
等 级:新手上路
帖 子:2
专家分:0
注 册:2011-4-20
结帖率:100%
收藏
已结贴  问题点数:20 回复次数:5 
求助:有个关于"游戏的玩法 "的程序考试题,如何编写?谢谢
求助:有个关于"游戏的玩法 "的程序考试题,如何编写?谢谢
Playing the game will involve two steps. First, the user writes an X or an O in one cell and then presses the PLAY button. The program should then check if there is a winner. If yes, the message “Player X won!” or “Player O won!” should be displayed.
The game ends when a user has N number of X/O s on the same row, column or diagonal –where N is the size of the board.
For example, in all the following snapshots of the game, player X won (the character _ is used to denote that nothing was played in that cell):
Diagonal        row            column
X O _ O    or    X XXX        or    O _ X  X
O X X O        O _ O _            X O X X
_ _ X O            _ O _  _        O O X O
_ _ _ X            _ _ _ _            X O X O



[ 本帖最后由 ftyy 于 2011-4-21 11:59 编辑 ]
2011-04-20 16:20
voidx
Rank: 12Rank: 12Rank: 12
来 自:邯郸
等 级:火箭侠
帖 子:1250
专家分:3538
注 册:2011-4-7
收藏
得分:7 
楼主把完整的题目要求发上来
2011-04-20 17:09
ansic
Rank: 14Rank: 14Rank: 14Rank: 14
来 自:恍惚窈冥
等 级:城市猎人
帖 子:1543
专家分:5367
注 册:2011-2-15
收藏
得分:7 
⊙﹏⊙b汗 都是E文耶

善人者,不善人之师;不善人者,善人之资。不贵其师,不爱其资,虽智大迷。
2011-04-20 17:25
njkido
Rank: 9Rank: 9Rank: 9
等 级:蜘蛛侠
帖 子:224
专家分:1184
注 册:2011-3-8
收藏
得分:7 
个人想法:
======================
胜利坐标集如下:

行胜利
{(0,0)(0,1),...,(0,N-1)}
{(1,0)(1,1),...,(1,N-1)}
...
{(N-1,0)(N-1,1),...,(N-1,N-1)}

列胜利
{(0,0)(1,0),...,(N-1,0)}
{(0,1)(1,1),...,(N-1,1)}
...
{(0,N-1)(1,N-1),...,(N-1,N-1)}

对角线胜利
{(0,0),(1,1),...,(N-1,N-1)}

===================================
N*N的矩阵 每下一步就遍历“胜利坐标集 ”

1 符合胜利坐标集,游戏结束,某一方win
2 不符合胜利坐标集
2.1 矩阵未满 继续游戏
2.2 矩阵满 游戏结束 draw
2011-04-20 17:42
ftyy
Rank: 1
等 级:新手上路
帖 子:2
专家分:0
注 册:2011-4-20
收藏
得分:0 
以下是引用voidx在2011-4-20 17:09:29的发言:

楼主把完整的题目要求发上来
Description
This project will give you exposure to the various types of loops, general procedures and arrays.
You will need to make a program that will play the TIC-TAC-TOE game.
Step 1:
The interface should contain 6x6 textboxes and a play button. Initially all the textboxes should be read only. When the program starts, the user should be asked for a board size and a number of uses playing.


[ 本帖最后由 ftyy 于 2011-4-21 12:00 编辑 ]
2011-04-20 18:10
voidx
Rank: 12Rank: 12Rank: 12
来 自:邯郸
等 级:火箭侠
帖 子:1250
专家分:3538
注 册:2011-4-7
收藏
得分:0 
难道是求作业?

按照规定应该被删除~而且这么简单的作业居然也拿来求~自己回去看书都能解决了

[ 本帖最后由 voidx 于 2011-4-20 18:20 编辑 ]
2011-04-20 18:14
快速回复:求助:有个关于"游戏的玩法 "的程序考试题,如何编写?谢谢
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.014489 second(s), 8 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved