increpare / increpare/PuzzleScript

think about Clementsparrow: Optimization: Expand rules with multi-layer properties layer by layer

Open
#753 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
JavaScript
Stars
1.1k
Forks
185
PR merge metrics
No merged PRs in 30d

Description

Currently, when a property is found on the LHS of a rule and it's not a single-layer property (i.e. it includes objects that are on different layers), the rule is expanded for each value of the property. Instead, it could be expanded for each layers it has objects in, and benefit from the optimizations available to single-layer properties. Also reducing the number of rules that have to be tested.

The problem is that the resulting single-layer property might not exist as an identifier, which means that we have either to create an identifier for it, or use a different representation than identifiers (masks?) at this stage of the parsing. Also, we would need to compute the mappings implying these new single-layer properties, which in turn can create new, multi-layer, properties.

Another option would be to do as we currently do, but merge the rules that can be described with single-layer properties afterward. This option seems more difficult to code and less efficient, but it could actually make the code more robust and general (merging user-provided rules, for instance), by moving out of ruleToMask the need to consider single-layer properties.

The same optimization could be performed for property rule parameters.

https://github.com/ClementSparrow/Pattern-Script/issues/20

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the issue's discussion of rule expansion and inspect ruleToMask, the current handling of multi-layer properties, and property rule parameters. Compare expanding layer by layer with merging rules afterward, including how identifiers and mappings would be represented. Done means the selected optimization is implemented without breaking the resulting rule mappings.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
game-dev
Issue type
Refactor
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.