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

Implement more sensory commands #1171

Closed
6 of 9 tasks
kostmo opened this issue Mar 20, 2023 · 2 comments
Closed
6 of 9 tasks

Implement more sensory commands #1171

kostmo opened this issue Mar 20, 2023 · 2 comments
Assignees
Labels
L-Commands Built-in commands (e.g. move, try, if, ...) in the Swarm language. Z-Feature A new feature to be added to the game.

Comments

@kostmo
Copy link
Member

kostmo commented Mar 20, 2023

From this comment:

sniff : text -> cmd int

Olfactory. Physically interpreted as a "point sensor", thus cannot infer direction. Return the distance to the nearest entity of a given name. To use it, the player can move around in different directions to see whether they are getting "hot" or "cold".

chirp : text -> cmd dir

Sonar based on two "ears" will return the direction to the nearest entity of a given name. To use it, the player can move in said direction until the reported direction reverses, and then progressively home in on it (or switch to another close-range sensing modality).

resonate : text -> ((int * int) * (int * int)) -> cmd bool

The original Boolean type signature. Usage would entail a quadtree search strategy. The physical justification is more of a stretch, but could entail something like MRI, where a strong magnetic field is applied over a given area, and a stimulating pulse is emitted, exciting the particles of the entity in question. A non-directional signal is returned from the excited area, with a receiver being tuned to the frequency of the entity's particles.

@kostmo kostmo added Z-Feature A new feature to be added to the game. L-Commands Built-in commands (e.g. move, try, if, ...) in the Swarm language. labels Mar 20, 2023
@kostmo kostmo self-assigned this Mar 20, 2023
kostmo added a commit that referenced this issue Mar 27, 2023
kostmo added a commit that referenced this issue Mar 27, 2023
mergify bot pushed a commit that referenced this issue Mar 29, 2023
towards #1171

## New tests

Unit tests:

    scripts/run-tests.sh --test-arguments '--pattern "Relative direction"'

Integration tests for `sniff` and `chirp` demonstrate how to home in on an item using distance and orientation, respectively.

## Efficiency

For the sake of execution time, I have capped the max "diameter" (`N`) of both commands to `200` cells.  In the worst case (the entity is not present), `O(N^2)` cells are inspected, which manifests as a perceptible delay when the command is run.  I came across the `getElemsInArea` function that seems to suggest that an `O(N * log N)` search may be possible.  Is that the case?

Otherwise we may be able to add some new data structures to the game state for efficient entity location querying.
mergify bot pushed a commit that referenced this issue Apr 9, 2023
Towards #1171

The `resonate` command counts entities of a given type within a rectangle.

This PR also fixes a bug in `detect` when the rectangle coords are non-ascending.
mergify bot pushed a commit that referenced this issue Apr 20, 2023
@byorgey
Copy link
Member

byorgey commented Apr 25, 2024

Collecting some ideas here for recipes + new devices (will fill in more detail later).

  • rolex:
    • 1 clock
    • 1 scanner
    • This would be kind of difficult to make, but watch doesn't really add a whole lot of expressive capability, it's just more efficient (without watch you can just use a scanner to poll the adjacent location).
  • olfactometer:
  • dozer blade:
  • Proposed device for chirp:
  • Proposed device for resonate:

@byorgey
Copy link
Member

byorgey commented Apr 30, 2024

Closing this in favor of #1813, to keep things more self-contained.

@byorgey byorgey closed this as completed Apr 30, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
L-Commands Built-in commands (e.g. move, try, if, ...) in the Swarm language. Z-Feature A new feature to be added to the game.
Projects
None yet
Development

No branches or pull requests

2 participants