我正在控制台上创建一个Shuffle游戏。 3x3网格,0表示交换。使用L,R,D,U移动E周围的标记/数字以检查排列是否正确。 [英] I am creating a Shuffle Game on Console. 3x3 grid, 0 to be the swap. use L,R,D,U to move the tokens/numbers around E to check the arrangement is correct.

查看:67
本文介绍了我正在控制台上创建一个Shuffle游戏。 3x3网格,0表示交换。使用L,R,D,U移动E周围的标记/数字以检查排列是否正确。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

规则如下

1 - >当游戏开始时,应用程序以最少的击键次数显示完成游戏的玩家的名字。然后,它在3×3网格中以随机顺序显示从0到8的数字



2 - >游戏的目的是按照升序排列数字。



1 2 3

4 5 6

7 8 0







有针对性的数字安排网格



3 - >零表示空置空间,因此它应该是最后一个。



4 - >数字可以在网格中向上,向下,向左或向右移动。



5 - >数字可以移动与空置空间交换。



6 - >一次只能移动一个号码。



7 - >只有与同一行或列中的空置空间相邻的数字才能与空置空间交换。



8 - >数字不能对角移动。



9 - >游戏没有时间限制。但是,应该计算完成游戏所需的按键次数。





设计规格



游戏的设计应符合以下规格:



1 - >这是一款单人游戏。



2 - >完成游戏没有时间限制。



3 - >每次开始新游戏时,屏幕上最初显示的数字应该随机播放。



4 - >零表示空置。



5 - >玩家可以交换与零相邻的数字。此数字应与零在同一行或列中。



6 - >空置的零位,可以向左,向右,向上或向下移动。



7 - >通过按下以下键,玩家可以将数字与零交换:



a - > L或l:用左边的数字交换0。



b - > R或r:用右边的数字交换0。



c - >你或你:用上面的数字交换0。



d - > D或d:用下面的数字交换0。



6 - >在按升序排列所有数字后,玩家将按键盘上的E或e结束游戏。



7 - >当玩家按下E或e时,程序将检查玩家是否正确排列了数字并相应地显示消息。



8 - >应计算完成游戏的击键次数。如果计数小于记录计数,则应要求玩家输入他/她的姓名。播放器的名称和击键次数应作为新记录保存在文件中。当玩家开始新游戏时,此名称和击键次数应出现在屏幕上。

the rules are as follows
1--> When the game starts, the application displays the name of the player who has completed the game in the minimum number of keystrokes. Then, it displays the numbers from zero to eight in random order in a 3×3 grid

2--> The objective of the game is to arrange the numbers in ascending order, as shown in the following arrangement.

1 2 3
4 5 6
7 8 0



Targeted Arrangement of Numbers in the Grid

3-->Zero indicates vacant space and therefore, it should come at the last.

4-->Numbers can be moved up, down, left, or right within the grid.

5-->The numbers can be moved by swapping them with the vacant space.

6-->Only one number can be moved at a time.

7--> Only the numbers adjacent to the vacant space in the same row or column can be swapped with the vacant space.

8-->A number cannot be moved diagonally.

9-->There is no time limit for the game. However, the number of key presses required to complete the game should be counted.


Design Specifications

The design of the game should be as per the following specifications:

1--> It is a single-player game.

2--> There is no time limit for completing the game.

3--> The numbers that initially appear on the screen should be shuffled each time a new game is started.

4--> Zero indicates a vacant place.

5--> The player can swap a number that is adjacent to zero. This number should be in the same row or column as zero.

6--> The vacant place, zero, can be moved left, right, up, or down.

7--> A player can swap a number with zero by pressing the following keys:

a--> L or l: Swaps 0 with the number on its left.

b--> R or r: Swaps 0 with the number on its right.

c--> U or u: Swaps 0 with the number above.

d--> D or d: Swaps 0 with the number below.

6--> After arranging all the numbers in ascending order, the player will press E or e on the keyboard to end the game.

7--> When the player presses E or e, the program will check whether the player has arranged the numbers correctly and display a message accordingly.

8--> The number of keystrokes to complete the game should be counted. If the count is less than the record count, the player should be asked to enter his/her name. The name of the player and the number of keystrokes should be saved in a file as the new record. This name and the number of keystrokes should appear on the screen when a player starts a new game.

推荐答案

猜猜问题是完美的

jst尽快需要代码



再猜一次。



我们不做你的作业:这是有原因的。它就是为了让你思考你被告知的事情,并试着理解它。它也在那里,以便您的导师可以识别您身体虚弱的区域,并将更多的注意力集中在补救措施上。



亲自尝试,你可能会发现它不是和你想的一样困难!
"guess the question is perfect
jst need the code as soon as possible"

Guess again.

We do not do your homework: it is set for a reason. It is there so that you think about what you have been told, and try to understand it. It is also there so that your tutor can identify areas where you are weak, and focus more attention on remedial action.

Try it yourself, you may find it is not as difficult as you think!


这篇关于我正在控制台上创建一个Shuffle游戏。 3x3网格,0表示交换。使用L,R,D,U移动E周围的标记/数字以检查排列是否正确。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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