一个9 * 9的填字游戏 [英] a 9*9 crossword puzzle

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

问题描述

大家好,

我应该用c ++编写一个填字游戏,我不知道从哪里开始。

请帮忙 -

hello everyone,
I am supposed to code a crossword puzzle in c++ in I don''t know where to begin.
please help-

推荐答案

从哪里开始?当然,每个致力于认真工作的人都会从收集有意编写的软件的要求开始。

你对布局没有说什么,所以我首先要定义单词是怎样的在网格中布局。首先想一想:



一个单词前面有一个起始块吗?

是否允许阻止矩阵元素,或者整个网格是否填充了字符,除了需要它们的起始块?

如果单词起始块也填充了一个字符,它们只包含提示的编号和这个词的写作方向是什么?

是否可以向后写字以及如何在网格中显示?



其他一些感兴趣的问题:



在尝试构建网格时,可以通过字长搜索您喜欢的语言的词典会花花公子? />
玩家找到正确单词的提示是什么类型?



首先考虑一下你想要/需要做什么,然后想想如何解决这个问题。

例如,如果您的网格仍然存在问题对于9x9,你的词典中不需要超过9个单词。



问候,



- Manfred
Where to start? Of course everyone committed to doing a serious job will start by gathering the requirements for the software one intends to write.
You said nothing about the layout, so I''d start by defining how words will be laid out in the grid. Start by thinking about this:

Does a word have a start block in front of it?
Are blocked out matrix elements allowed, or does the whole grid be filled with characters, apart from the starting blocks when they are needed?
Should the word start blocks also be filled with a character of do they only contain the number for the hint and the direction in which the word is to be written?
Should it be possible to write words backwards and how will this be indicated in the grid?

Some other questions of interest:

Dictionaries of words in the language of your preference searchable by word length would come in dandy when trying to construct the grid?
Of what kind are the hints for the player to find the correct words?

First think about what exactly you want/need to do, then think about how this can be solved.
For instance if your grid will remain constrained to 9x9 there will be no need to have words longer than 9 at most in your dictionary.

Regards,

— Manfred


首先你必须了解一些C ++,并且有很多网站可供选择。然后以3种方式考虑您的计划。

您需要什么样的数据?

该程序对用户来说应该是什么样子?

您的程序需要执行哪些步骤为了工作?



要考虑的事情



显然你需要一个9 * 9网格可能包含字符。你只需要一个网格,还是需要部分填充的网格,也许你需要一个带有正确数据的答案网格来比较它?

你只需要字母或额外数据来表示,黑色方形,白色方形,方形由用户选择?



填字游戏是否会以图形方式显示?

是否会一次呈现一个线索或者一次性全部?

您是否允许用户直接与网格交互并填写单个字符,或者他们会输入线索的答案,然后将答案显示在网格中,如果它''对吗?如果它适合?如果它不合适,你会立即或最后告诉他们答案是错的吗?



你怎么知道游戏结束的时候已经到达?你会允许用户放弃吗?你会给他们一个积分,他们有多少是正确的,或者只是在他们把它们弄好的时候才给他们打勾?

这会是一场戏,或者你想要一个''数据库''问题集和网格,以保持用户的兴趣。

用户如何选择要回答的问题,回答问题,查看答案的结果,找出他们是对还是错。



当你得到所有这些问题的答案时,你会有一个详细的规范,并清楚地知道你想要达到的目标。然后你可以将问题分解成小块并一次解决一个。

创建一个大纲空应用程序,你需要的类型是Console,Win32,WinForms,WPF或者其他什么,并确保它构建和运行空白或空白输出。

添加存储游戏数据所需的基本数据结构,数组,结构和类的定义,以及加载和保存数据的代码,如果它''不会硬编码到程序中。

现在您可以处理渲染游戏板,问题向导或您选择的任何形式的UI。永远记住你正在绘制数据的当前状态,比如动画的单帧。

一旦你可以想象一个基本数据集,你可以处理用户交互,从中获取答案用户并根据键入的内容更改数据,单击或选择。这是大纲过程,

目前的游戏数据状态

从用户那里获得输入

修改游戏数据的状态

重复,直到满足你的最终条件。



祝你好运和编程愉快。
First you have to know some C++ and there are plenty of sites for that. Then consider your program in 3 ways.
What data do you need?
What should the program look like to the user?
What steps does your program need to go through in order to work?

Some things to consider

Clearly you need a 9 * 9 grid with the potential to contain characters. Do you just need one grid or do you need the partially filled in grid and perhaps an answer grid with the correct data in to compare it to?
Do you just need letters or extra data to indicate, black square, white square, square selected by user?

Will the crossword be presented graphically?
Will the clues be presented one at a time or all at once?
Will you let the user interact directly with the grid and fill in individual characters or will they type answers to the clues and then have the answer appear in the grid, if it''s right? if it fits? What if it doesn''t fit, will you let them know an answer is wrong immediately or at the end?

How will you know when the end of the game has been reached? Will you allow the user to give up? Will you give them a points score for how many they got right or just a tick only if they get them all right?
Will this be a play once game or will you want a ''database'' of question sets and grids to keep your users interested.
How will the user choose which question to answer, answer the question, see the result of their answer, find out if they were right or wrong.

By the time you have answers to all these questions you''ll have a detailed specification and a very clear idea of what you want to achieve. Then you can break the problem into small pieces and solve one at a time.
Create an outline empty application of the type you need Console, Win32, WinForms, WPF or whatever and make sure it builds and runs with empty or blank output.
Add definitions for the basic data structures, arrays, structs and classes you''ll need to store your game data and possibly code to load and save that data if it''s not going to be hard coded into the program.
Now you can work on rendering your game board, question wizard or whatever form of UI you choose. Always remember you''re drawing the current state of your data, like a single frame of an animation.
Once you can visualise a basic data set you can work on the user interaction, getting answers from the user and changing your data based on what they type, click or select. That''s the outline process,
present state of the game data
get input from the user
modify the state of the game data
repeat until your end condition is met.

Good luck and happy programming.


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

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