Pac-Man (AR Friendly): Use Vector Components to Guide Pac-Man to Food

Pac-Man (AR Friendly): Use Vector Components to Guide Pac-Man to Food
Loading the math board and drawing, please wait…
2020-05-20 01:09
① This example uses the classic Pac-Man game as a scenario to demonstrate how to decompose vector components to guide Pac-Man in the correct direction to reach food, making abstract vector concepts engaging and interactive. ② Core mathematical concepts include 2D/3D vector decomposition and composition, vector addition, direction and magnitude, as well as random sequences and parametric equations for dynamic paths. ③ Construction highlights: Using GeoGebra commands such as Random, Sequence, Union, Vector, RandomElement, CurveCartesian, Translate, Rotate, Line, Surface, and Dilate, the construction builds Pac-Man (composed of arcs and rotations), food points, auxiliary vectors, and button controls (button1, button2), with a slider (MouthSpeed) to animate the mouth opening and closing, making it AR-friendly. ④ Suitable for middle school mathematics (especially vector teaching), introductory linear algebra in college, STEM education, or gamified learning, helping students intuitively understand the role of vector components in navigation and path planning.

GeoGebra Commands & Parameters

  1. Random(-5, 5) → a
  2. Sequence(i, i, a + 1, 5, 1) → l3
  3. Sequence(i, i, -5, a - 1, 1) → l2
  4. Union(l2, l3) → l4
  5. Vector((xc, yc, zc)) → u
  6. Random(-5, 5) → c
  7. RandomElement(l4) → b
  8. CurveCartesian(x(A) - sin(t), y(A) + cos(t), z(A), t, 0, π) → g
  9. Translate(A, u) → A'
  10. Vector(A, A') → v
  11. Rotate(A - (0, 1.5, 0), If[yc ≥ 0, α, (2 * π) - α], A, Line[A, A + (0, 0, 1)]) → D
  12. Rotate(A + (0, 1.5, 0), If[yc ≥ 0, α, (2 * π) - α], A, Line[A, A + (0, 0, 1)]) → C
  13. Rotate(g, If[yc ≥ 0, α, (2 * π) - α], A, Line[A, A + (0, 0, 1)]) → g'
  14. Rotate(g', If[zc ≥ 0, β, (2 * π) - β], A, If[zc ≥ 0, Line[C, D], Line[D, C]]) → g''
  15. Random(-5, 5) → d
  16. Random(-5, 5) → e
  17. Random(-5, 5) → f
  18. Line(C, D) → j
  19. Surface(g'', (3 * π / 4) + m, Line[C, D]) → k
  20. Dilate(A, If[0 < PlayToSee ≤ 1, 1 - PlayToSee, 0], A') → A'_1
  21. Surface(g'', (3 * π / 4) + m, Line[D, C]) → i
  22. Vector(A, A'_1) → w
  23. Translate(i, w) → i'
  24. Translate(k, w) → k'
  25. Sequence(i, i, -5, 5, 1) → l1