Commit Graph

7 Commits

Author SHA1 Message Date
hypercross 9ef387f010 refactor(tests): extract test helpers and clean up play tests
Refactor the TicTacToe test suite by moving shared logic, such as
game setup, snapshotting, and win checking, into a new
`TestHelpers` class. This simplifies `PlayTests.cs` and
`GameFlowTests.cs`
by removing redundant private methods and local agent implementations,
replacing them with standardized utility calls from `OECS.PlayTest`.
2026-07-21 15:47:33 +08:00
hypercross 4cdfe9c957 refactor: update iterator access and simplify loops
Refactor code to use `Val1` and `Val2` instead of `Item1` and `Item2`
for
iterator access. Simplify `PlaceMarkCommand` and `WinCheckSystem` by
replacing `while` loops with `foreach` and removing redundant comments.
2026-07-21 11:09:55 +08:00
hypercross 5d7eb14911 refactor: simplify iterator usage and improve command execution
- Replace manual `while (iter.MoveNext())` loops with `foreach` loops in
  tests
- Implement batching and mutation flushing in `CommandQueue.ExecuteAll`
  to
  ensure chained commands see each other's changes
2026-07-21 10:09:40 +08:00
hypercross 96d732d6ab refactor: simplify component iteration and singleton handling
Update the ECS engine to support automatic mutation tracking for
singletons during iteration, removing the need for manual
`MarkModified` calls.

- Update `ComponentDiscoveryGenerator` to detect singleton components.
- Refactor `PlaceMarkCommand` and `WinCheckSystem` to leverage
  automatic mutation marking.
- Replace `ForEach` usage with `Select` and `ItemN` access in tests
  and systems to align with the updated iterator API.
2026-07-21 09:15:27 +08:00
hypercross f8d0fe314c test: add play tests for Blackjack and TicTacToe
Implement play tests for Blackjack and TicTacToe that simulate games
using various AI agents (Basic Strategy, Random, Greedy) and record
the results, decisions, and reactivity into playlogs for debugging
and LLM analysis. Update documentation to reflect the purpose of
these tests.
2026-07-20 17:22:07 +08:00
hypercross e1fb197474 feat(oecs): improve serialization and add snapshot tests
Enhance the OECS framework to support more robust component
deserialization during world serialization. This includes adding
boxed component support and a runtime fallback for component
discovery.

Additionally, introduces snapshot testing patterns for Blackjack
and TicTacToe to allow for manual verification of world state and
reactivity logs.
2026-07-20 17:05:17 +08:00
hypercross b4661e714e test: add unit tests for Blackjack and TicTacToe
- Add xUnit test projects for both games
- Implement game flow tests for Blackjack
- Implement game flow tests for TicTacToe
- Rename namespaces and projects to follow `Game.*` convention
- Add documentation for testing games
2026-07-20 16:41:10 +08:00