Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

recognize structures with rotation #1678

Merged
merged 4 commits into from
Dec 13, 2023
Merged

Conversation

kostmo
Copy link
Member

@kostmo kostmo commented Dec 10, 2023

Closes #1644.

The "recognize" property in scenario .yaml files is changed from a boolean to a list of "up" directions.

The structure recognizer adds a rotated copy of each supported orientation to its automaton. Rotational symmetry is accounted for to avoid duplicate work in the recognizer.

Also in this PR:

  • Add cardinal directions to the JSON schema
  • Tetromino packing challenge scenario

Demos

scripts/run-tests.sh --test-arguments '--pattern "1644-rotated"'

Structures dialog

Screenshot from 2023-12-10 18-47-01

Tetromino packing

scripts/play.sh -i data/scenarios/Challenges/pack-tetrominoes.yaml --autoplay

Screenshot from 2023-12-09 23-11-00

@kostmo kostmo force-pushed the feature/reoriented-recognition branch 2 times, most recently from b831124 to 4ad2cf0 Compare December 10, 2023 07:13
@kostmo kostmo force-pushed the feature/reoriented-recognition branch from 4ad2cf0 to 3124d66 Compare December 10, 2023 07:13
@kostmo kostmo marked this pull request as ready for review December 10, 2023 07:19
@kostmo kostmo requested a review from byorgey December 10, 2023 07:20
@kostmo kostmo added the G-Scenarios An issue having to do with scenario design, the way scenarios are described and loaded, etc. label Dec 10, 2023
@kostmo kostmo added the merge me Trigger the merge process of the Pull request. label Dec 13, 2023
@mergify mergify bot merged commit 13ae996 into main Dec 13, 2023
9 checks passed
@mergify mergify bot deleted the feature/reoriented-recognition branch December 13, 2023 21:21
mergify bot pushed a commit that referenced this pull request Mar 15, 2024
Makes use of rotation-aware structure recognition (#1678) to simplify goal checking for word search (#999).

![Screenshot from 2024-03-13 18-48-53](https://github.com/swarm-game/swarm/assets/261693/6fc9e62e-d9e2-4a13-8969-32dbee695e0a)

# Benchmarks

Using the following command (GHC 9.6.4):

    scripts/run-tests.sh --test-arguments '--pattern "word-search"'

| Before | After |
| --- | --- |
| `0.98s` | `0.82s` |
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
G-Scenarios An issue having to do with scenario design, the way scenarios are described and loaded, etc. merge me Trigger the merge process of the Pull request.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Recognize structures with rotation
2 participants