The issue with asymmetric tiles and an easy solution
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 3/5
- Tempo stimato
- 1-2 giorni
- Idoneità per principianti
- 40/100
- Tipo di issue
- Bug
- Chiarezza
- Abbastanza chiara
- Stato di attività
- Ferma
- Stack tecnologico
- javascript
- Ambito
- game-dev
Direzione di ricerca
Non vengono indicati file, test o punti di ingresso. Individua la logica di corrispondenza dei lati delle tessere, segui il modo in cui vengono generati e confrontati i codici dei lati, quindi verifica che i lati simmetrici continuino a corrispondere a se stessi, mentre i lati asimmetrici corrispondano solo alla loro rappresentazione invertita.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
the issue with the tiles in hand is the asymmetry
when you have a symmetric side on the tile, they can match to themselves (meaning the key you assigned to them), like in the first row here:

But as you can see in the second row, when dealing with tiles with asymmetric sides, the matches are incorrect. The logic used to match sides (having the same code) is not valid for asymmetrical sides, as it allows them to match themselves which is wrong visually.
A quick fix for this is to use a more complex code to identify sides and update the logic that finds that two sides match. My quick fix is to use a 3 character key for each side: '000', '111', '222', '333', ... , 'aaa', 'bbb', 'ccc', etc and for the asymmetrical sides use values as '001' and '100' for their mirrored side. When matching sides instead of comparing their code, you must compare their code vs the reversed string of their code. In this way, '000' matches '000' (which keeps symmetrical sides working just fine) but '001' will only find a match in the reversed key '100' fixing asymmetrical sides.
In the previous example 4 becomes '001' and 5 becomes '100', allowing for them to match to the correct side but not themselves.
Annex:
My suggested solution was to create a method that figures out 3 pixels colours for each side of the tile: left, center and right. Once you have them create an array with those 3 values. To connect a tile to another, just compare the array to the reverse order of itself. This implements the symmetrical / asymmetrical solution and will allow for interchangeable tiles on the fly.
- Lingua principale
- JavaScript
- Stelle
- 219
- Fork
- 64
- Metriche di merge delle PR
- Nessuna PR unita negli ultimi 30g
Guida per i contributori
Nessuna guida per i contributori indicizzata per questo repository
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di CodingTrain/Wave-Function-Collapse
-
Optimize grid updates Aperta
Difficoltà 4/5 3-5 giorni Idoneità per principianti 20/100
CodingTrain/Wave-Function-Collapse#41 · 2 reazioni ·
-
Difficoltà 4/5 3-5 giorni Idoneità per principianti 35/100
CodingTrain/Wave-Function-Collapse#38 · 2 commenti ·
-
Difficoltà 5/5 Più di una settimana Idoneità per principianti 25/100
CodingTrain/Wave-Function-Collapse#37 · 1 commento ·
-
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 42/100
CodingTrain/Wave-Function-Collapse#35 · 1 commento ·
-
Do NOT make a new grid Aperta
Difficoltà 4/5 3-5 giorni Idoneità per principianti 30/100
Tutte le issue di CodingTrain/Wave-Function-Collapse
Issue simili
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 65/100
-
Theme loads third-party resources on every page (jsdelivr web font, cdnjs Font Awesome) – GDPR Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
docToolchain/docToolchain#1705 ·
-
Timezone select lists one option per character; duplicate "Failed" reason; shared tracker popover id Apertabug
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
nightscout/nocturne#1414 ·
-
bug v2
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
modelcontextprotocol/inspector#2458 · 1 commento ·
-
Mend: dependency security vulnerability status: needs triage 🕵️♀️
Difficoltà 2/5 1-3 ore Idoneità per principianti 70/100
carbon-design-system/ibm-products#9907 ·