简单游戏代码_简单游戏

简单游戏代码

Here are a few simple, working, games that you can use as-is or as the basis for your own games.

这里有一些简单,有效的游戏,您可以按原样使用或作为自己游戏的基础。

Tic-Tac-Toe 井字游戏

This is one of the simplest of all games.

这是所有游戏中最简单的游戏之一。

Tic-Tac-Toe.zip Tic-Tac-Toe.zip

The game allows for a choice of who goes first and keeps track of the number of wins for each person. Here is a picture of the game in action.

游戏允许选择谁先行,并跟踪每个人的获胜次数。 这是游戏的画面。

Two-Player game in action
Tic-Tac-Toe-VS-CPU.zip Tic-Tac-Toe-VS-CPU.zip Hangman man子手

Hangman is also a simple game but depending on the word you need to solve, it can be challenging. The words used are in a file called SecretWords.txt and it's included in the zip file. You can of course add to or delete words in the list.

man子手也是一款简单的游戏,但是根据您需要解决的单词,它可能具有挑战性。 所使用的单词在一个名为SecretWords.txt的文件中,并且包含在zip文件中。 您当然可以在列表中添加或删除单词。

Hangman.zip Hangman.zip

Here's a picture of the game in progress where the player is trying to solve the word 'elephant' and has incorrectly tried 'F'.

这是进行中的游戏的图片,其中玩家尝试解决“大象”一词并错误地尝试了“ F”。

Hangman in progress
Blackjack 二十一点

The 3rd and last game is blackjack which you can download from

第三和最后一个游戏是二十一点,您可以从中下载

here. 在这里

The programming for this game is more complex than the other two and here is what the game looks like.

该游戏的编程比其他两个程序更复杂,这就是游戏的外观。

Blackjack

The Options menu allows you to select the design for the back of the cards, the 'table' background color, the delay time between the dealing of each dealer's card, your starting bankroll, and the number of decks in play.

使用“选项”菜单,您可以选择纸牌背面的设计,“桌子”的背景颜色,每张发牌人的纸牌交易之间的延迟时间,起始资金以及游戏中的牌组数量。

Finally, the following is a very stripped down version of the blackjack game which demonstrates how to use the card deck.

最后,以下是二十一点游戏的精简版,演示了如何使用纸牌。

Card-Deck.zip Card-Deck.zip

It looks like this:

看起来像这样:

ml-Image1.jpg

If you find that this article has been helpful, please click the “thumb’s up” button below. Doing so lets me know what is valuable for EE members and provides direction for future articles. It also provides me with positive feedback in the form of a few points. Thanks!

如果您发现本文对您有所帮助,请单击下面的“竖起大拇指”按钮。 这样做可以让我知道对EE成员有价值的内容,并为以后的文章提供指导。 它还以几点的形式为我提供了积极的反馈。 谢谢!

翻译自: https://www.experts-exchange.com/articles/9009/Simple-Games.html

简单游戏代码

  • 4
    点赞
  • 9
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值