Hacktoberfest 2026: le issue che i maintainer hanno segnato per ottobre, aperte e adatte ai principianti. Sfoglia le issue Hacktoberfest

The issue with asymmetric tiles and an easy solution

Aperta
#16 0 commenti 4 reazioni 0 assegnatari Vedi su GitHub

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:

tile-collapse-issue1

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

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di CodingTrain/Wave-Function-Collapse

Tutte le issue di CodingTrain/Wave-Function-Collapse

Issue simili

Altre issue su JavaScript

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.