帮助制作一个刽子手程序 [英] Help making a hangman program

查看:57
本文介绍了帮助制作一个刽子手程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

嘿,我刚刚开始编程今年九月,我有一个任务,我应该创建一个刽子手游戏。这是我在这个论坛上的第一篇文章,请原谅我任何noob错误现在我还在学习Java所以这将是一个在控制台窗口(没有GUI)中使用字符串循环,数组等运行的基本程序,但希望没有太复杂。我已经开发了一些程序算法,但到目前为止它真的很简单。


标题画面

主菜单(播放,说明,退出)

如果他们选择选择播放有可供选择难度(简单,中等,难度)

取决于他们选择的难度会有不同的词语


现在我已经完成了所有这些简单的事情方式,我已经到了显示空白的部分,如_ _ _ _ _,现在我要做的是弄清楚如何从用户那里获取输入并用它来填充在空白中,给他们5个生命。我会通过什么样的流程来实现这一目标?我不是要求任何具体的代码,但我可能需要一些解释如何将所有内容拼凑在一起。


提前致谢!!!

解决方案

问候,yottabyte!


欢迎使用字节...您能告诉我们您提到的代码吗?你也可能需要做很多工作,因为我们会帮你解决这个问题。


虽然这很令人兴奋,但希望你活下来,它''很好的选择。


有点!


对于控制台应用程序,使用Scanner类来获取用户的输入如果您使用的是Java 6,则使用Console类。


此外,我还会创建一个生命,它会计算(谁会猜?)生命中有多少人离开了。然后你可以把它全部放在一个循环中...你应该能够弄清楚其余部分。


问候,

Nepomuk


Hey, I just started programming this September and I have an assignment in which I am supposed to create a hangman game. This is my first post on this forum so forgive me for any "noob" mistakes Now I''m still learning Java so this will be a basic program running in the console window (no GUI) using strings loops, arrays, etc but hopefully nothing too complicated. I''ve developed somewhat of an algorithm for the program, but it''s really simple so far.

Title screen
main menu (play, instructions, quit)
if they choose to select play there is a choice of difficulty (easy, med, hard)
depending on what difficulty they choose there will be different words

Now I''ve got all that simple stuff out of the way and I''ve gotten up to the part where it displays the blanks such as _ _ _ _ _ and now what I''m trying to do is figure out how to get input from the user and use it to fill in the blanks, and give them 5 "lives". What kind of process do I go through to make this happen? I''m not asking for any specific code but I might need some explanations on how I can piece everything together.

Thanks in advance!!!

解决方案

Greetings, yottabyte!

Welcome to bytes... Can you show us the code you referred to? Also you''ll probably need to do a lot of the work as we help you figure it all out.

It''s exciting though, hope you survive it, it''s quite the language, good choice.

In a bit!


For console applications, use the Scanner class to get the input from the user or the Console class if you are using Java 6.


Also, I''d create a couter lives which counts (who would guess?) how many lives are left. Then you can put it all in a while loop... you should be able to figure out the rest.

Greetings,
Nepomuk


这篇关于帮助制作一个刽子手程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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