Connect4游戏需要帮助 [英] Help needed with Connect4 game

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

问题描述

我最近在一个月前开始编程。我的老师让我做个游戏。连接4游戏。我尝试制作,但失败了。我需要帮助。


这是我的代码:

I recently started programing about a month ago. my teacher ask me to make a game. A connect 4 game. I try to make, but failed. I need help.

here is my code:

展开 | 选择 | Wrap | 行号

推荐答案

请将您发布的代码附在[code]标签中(参见如何提出问题)。


这使我们的专家更容易阅读和理解它。如果不这样做会给版主带来额外的工作,从而浪费资源,否则可以回答会员的问题。


请将来使用[code]标签。


MODERATOR
Please enclose your posted code in [code] tags (See How to Ask a Question).

This makes it easier for our Experts to read and understand it. Failing to do so creates extra work for the moderators, thus wasting resources, otherwise available to answer the members'' questions.

Please use [code] tags in future.

MODERATOR


请记住为任何已启动的线程提供有意义的标题(请参阅FAQ条目使用好的主题标题


这有助于确保其他成员,而且普通大众也有更好的机会找到任何类似问题的答案。


MODERATOR
Please remember to provide a meaningful Title for any threads started (see the FAQ entry Use a Good Thread Title).

This helps to ensure that other members, and also the general public, will have a better chance of finding answers to any similar questions.

MODERATOR



我的问题是,我怎么能这样做,以便它检查我是否赢了?
the problem I ahve is that, how can I make it so that it checks if i''ve won or not?



您需要在代码中更多地利用循环和数组。例如,而不是count,count2,count3,...使用数组。您应该可以缩短您的代码。


然后考虑在游戏面板上搜索模式以查看玩家是否赢了。

You need to exploit loops and arrays more in your code. For example, instead of count, count2, count3, ... use an array. You should be able to shorten your code.

Then think of searching for patterns on the game panel to see if a player has won.


这篇关于Connect4游戏需要帮助的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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