Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Sep 2, 2025

This PR implements comprehensive mocking support for both Pygame and Arcade, the two most popular Python game development libraries used in educational settings.

What's Added

Arcade Mock (MockArcade)

Arcade is a modern, Pythonic game library designed specifically for education. The mock captures:

  • Window management (open_window, set_background_color, close_window)
  • Drawing operations (circles, rectangles, lines, text)
  • Sprite creation and management with physics
  • Sound loading and playback
  • Game loop scheduling and timing
  • Collision detection functions
  • Color constants

Pygame Mock (MockPygame)

Pygame is the classic Python game library with widespread adoption. The mock captures:

  • Core initialization and cleanup (pygame.init(), pygame.quit())
  • Display management (pygame.display.set_mode(), pygame.display.flip())
  • Drawing functions (pygame.draw.rect(), pygame.draw.circle(), etc.)
  • Event handling (pygame.event.get())
  • Sound/mixer support (pygame.mixer.Sound)
  • Clock and timing (pygame.time.Clock)
  • Surface, Color, and Rect object creation

Educational Benefits

Both mocks follow the same pattern as the existing matplotlib mock, allowing educators to:

  • Inspect student game development code without requiring actual game libraries
  • Verify that students are using proper game development patterns
  • Track drawing operations, sprite interactions, and game state
  • Provide automated feedback on game structure and logic

Example Usage

# Student code that would normally require Arcade installation
import arcade

arcade.open_window(800, 600, "My Game")
arcade.set_background_color(arcade.color.WHITE)

arcade.start_render()
arcade.draw_circle_filled(100, 100, 50, arcade.color.RED)
arcade.finish_render()

# Educator can now inspect the mock data
sandbox = get_sandbox()
arcade_mock = sandbox.modules.arcade
assert len(arcade_mock.draw_commands) == 3  # start_render, circle, finish_render
assert arcade_mock.window['title'] == "My Game"

The implementation includes comprehensive test coverage with both unit tests for the mock classes and integration tests demonstrating usage within the pedal sandbox system.

Fixes #9.


💬 Share your feedback on Copilot coding agent for the chance to win a $200 gift card! Click here to start the survey.

Copy link
Contributor Author

Copilot AI commented Sep 2, 2025

@acbart 👋 This repository doesn't have Copilot instructions. With Copilot instructions, I can understand the repository better, work faster and produce higher quality PRs.

I can generate a .github/copilot-instructions.md file for you automatically. Click here to open a pre-filled issue and assign it to me. I'll write the instructions, and then tag you for review.

Copilot AI changed the title [WIP] Pygame/Arcade Mocking Add Pygame and Arcade mocking support for educational game development Sep 2, 2025
Copilot AI requested a review from acbart September 2, 2025 01:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Pygame/Arcade Mocking

2 participants