Skip to content

mid

:material-circle-edit-outline: 约 1675 个字 :material-clock-time-two-outline: 预计阅读时间 6 分钟

\1. 多选题 (5 分)

Which statements are true about Pygame’s Font module?

□ The module can load font data from a font installed with the operating system.

□ The module can only load font data from a file distributed with your game.

□ When you call the render method of a font object, it will draw the text on

the display surface.

□ The font object cannot render more than a single line of text at once. If you

want to word-wrap a long string into a multi-line paragraph, you will call

render multiple times.

AD

Which statements are true about Navmeshes and the Funnel Algorithm?

□ Navmeshes are an abstraction, which loses positional information. Exact nav

igation will require additional algorithms.

□ Navmeshes retain full information about each polygon, so exact navigation is

still achievable by running A* on the mesh graph.

□ The Funnel is represented by two line segments, one on the right and the other

on the left.

□ The Funnel Algorithm must have a list of the portals through which the path

must go. The algorithm itself does not determine which are the portals of

interest.

□ When the left line segment crosses over either the right line segment or the

portal line segment, then the algorithm is complete and the path has been

determined.

BCD

What does a mean in the pygame.display.set_caption(a) function?

A. Title content of the game main window

B. Title color of the game main window

C. Title display mode of the game main window

D. Title image path of the game main window

A

Given a Surface object s, its method s.fill(a) is used to fill, what does a mean?

A. The string of text to be filled

B. The Surface object of the image to be filled

C. The sprite object of the animation to be filled

D. The RGB value of the color to be filled

D

Which algorithm is a single-source, all-destinations Navigation algorithm?

□ Dijkstra

□ A*

□ Breadth-first search with pathfinding

□ Early exit

□ Navmesh

□ None of the above

AC

\6. 多选题 (5 分)

Which statements are true about the game-loop architecture?

□ The game-loop architecture is often used because it is responsive to user inputs.

□ Each time around the game loop a new frame is rendered based on the game

state.

□ Each time around the game loop, the game state is initialized.

□ The Model is the human figure from which the graphic artist has drawn avatars.

□ If too much computation is done in each iteration of the game loop, then

performance lag will be visible to the user.

□ The game loop should always run at more than 120 frames per second.

ABE

\7. 单选题 (5 分)

a = pygame.image.load(filename) is used to load an image, what type is a?

A. Image

B. Surface

C. Event

D. Rect

A

\8. 多选题 (5 分)

Which maze algorithms generate bias free mazes?

□ The Binary Tree Algorithm

□ Dijkstra’s Algorithm

□ Wilson’s Algorithm

□ The Sidewinder Algorithm

□ The Recursive Backtracking Algorithm

□ The Aldous-Brouder Algorithm

CF

\9. 多选题 (5 分)

According to our textbook, what is a game?

□ A computer program where competition and strategy provide fun.

□ It is entertaining.

□ It involves play.

□ It has real-world ramifications like gambling.

ABC

\10. 多选题 (5 分)

Which statements are correct about the Pygame engine?

□ It includes modules for many useful game-related tasks, like drawing, keyboard

input, control of timing, and even managing CD-ROM playback.

□ The game object includes a run method that you should call in order to have

the game code executed.

□ The surface class represents a canvas on which you can draw images.

□ The surface class represents an array in memory where the pixel color values

are stored and manipulated.

□ Only one surface – the display surface is useful for rendering your game’s

frame.

□ Direct manipulation of individual pixel values is possible, but some algorithms

are included to simplify drawing and rendering images.

ACDF

\11. 单选题 (5 分)

The following Python statements are correct.

A. min = x if x < y else y

B. max = x > y and x : y

C. if (x > y) print x

D. while True : pass

A

\12. 单选题 (5 分)

The following statements cannot create a set.

A. s1 = set ()

B. s2 = set ("abcd")

C. s3 = (1, 2, 3, 4)

D. s4 = frozenset( (3,2,1) )

C

\13. 单选题 (5 分)

The following statements cannot create a dictionary.

A. dict1 = {}

B. dict2 = { 3 : 5 }

C. dict3 = dict( [2 , 5] ,[ 3 , 4 ] )

D. dict4 = dict( ( [1,2],[3,4] ) )

C

screen is the main form object, what are the functions of a and b in screen.blit(a, b)?

image-20241124150203627

What is the program control structure of the main body of the Pygame game minimum development framework?

A. Exception response

B. Event-driven

C. Sequential structure

D. Infinite loop

Where is the origin (0,0) in the Pygame game window coordinate system?

A. Upper left corner

B. Center of the window

C. Center of the left side

D. Lower left corner

Which statements are true about mazes?

□ A unicursal maze is easy to solve.

□ The recursive backtracking algorithm automatically chooses the cell for the

entry and exit of the resulting maze.

□ A braided maze has loops, but no dead-ends.

□ A wall carving algorithm like Binary Tree can only work when the cells are

rectangular or square.

□ A drunken walk algorithm starts with an empty grid and randomly chooses

which walls to add. It is named that way because a person who is drunk needs

walls to lean against for support.

ACDE

If you use the Linear Congruential Generator for random numbers and choose the c parameter to equal zero (like Prof Nace did in class), then:

□ You are guaranteed to get the longest cycles possible.

□ The numbers will be truly random, a TRNG.

□ A zero seed (Xn) will always return nothing but zeros.

□ Then you should ensure the a parameter is also zero.

□ Then you should ensure the m parameter is a prime number.

C

Which statements are true about the demonstrations Prof. Nace showed in class about Sprite and Group classes?

□ His code for Pacman was able to run from the Ghosts.

□ The collision detection between Mario sprites was well-tuned and showed very

realistic collisions.

□ He showed several versions of Mario falling.

□ He showed animation of Mario running and jumping.

□ He showed animation of Mario rescuing Princess Peach.

C

What does a mean in the pygame.display.set_mode(a) function?

A. Variables that represent the initialization window

B. Initialization window size, expressed in the form of a two-tuple (width, height)

C. Initialization window mode, indicating full screen, adjustable size, etc.

D. Initialization window color, RGB or RGBA color expressed in the form of a tuple

以下是关于 Navmeshes(导航网格)和 Funnel Algorithm(漏斗算法)的正确描述与解释:

  1. Navmeshes are an abstraction, which loses positional information. Exact navigation will require additional algorithms. 正确。 Navmeshes是一种抽象表示,用于简化环境的导航。虽然它能有效表示可通行区域,但其精确的位置信息是简化后的,因此在使用Navmeshes导航时,需要额外的算法(如路径优化或细粒度处理)来确保精确的导航。
  2. Navmeshes retain full information about each polygon, so exact navigation is still achievable by running A* on the mesh graph. 部分正确,需补充说明。 Navmeshes确实包含每个多边形的信息,A算法可用于找到跨越多边形的路径。但仅运行A算法并不能保证“精确导航”,因为路径仍需投影到几何上,并通过进一步计算生成具体的平滑路径。
  3. The Funnel is represented by two line segments, one on the right and the other on the left. 正确。 漏斗算法中的“漏斗”由两个边界线段表示:一个是右边界,一个是左边界。它们用于引导路径的收敛,直到找到最终的优化路径。
  4. The Funnel Algorithm must have a list of the portals through which the path must go. The algorithm itself does not determine which are the portals of interest. 正确。 漏斗算法的输入包括已排序的“门”(portals)列表,这些门通常由更高层次的路径规划算法(例如A*)提供。漏斗算法并不负责决定哪些门是关键路径,而是优化给定门序列中的路径。
  5. When the left line segment crosses over either the right line segment or the portal line segment, then the algorithm is complete and the path has been determined. 错误。 在漏斗算法中,当左边界和右边界交叉时,不是算法完成的标志,而是表明需要调整“漏斗”的边界。如果发现某一边界发生交叉,需要在路径中添加一个“顶点”(apex),并更新边界,以确保路径是合法且优化的。

总结

  • 正确的描述: 1、3、4
  • 部分正确或有误的描述: 2(需补充精确路径的计算过程)、5(关于漏斗边界的处理机制描述错误)。

Which of the following statements is illegal in Python? D. x += y x=x+y