Skip to content

Commit

Permalink
added index to modules for easier custom logic
Browse files Browse the repository at this point in the history
  • Loading branch information
zfedoran committed Apr 4, 2022
1 parent 0e4bc76 commit ebd5d12
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
1 change: 1 addition & 0 deletions pkg/wfc/module.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import (
// Stalberg. A module is a possible tile that might exist at a slot in the wave
// function grid. It can be thought of as a single state of a superposition.
type Module struct {
Index int // The index of the module in the input tiles
Adjacencies [4]ConstraintId // Adjacency constraints for each direction
Image image.Image // The tile image for the module
}
Expand Down
2 changes: 1 addition & 1 deletion pkg/wfc/wave.go
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ func NewWithCustomConstraints(tiles []image.Image, width, height int, fn Constra

// Automatically generate adjacency constraints for each input tile.
for i, tile := range tiles {
module := Module{Image: tile}
module := Module{Index: i, Image: tile}
for _, d := range Directions {
module.Adjacencies[d] = fn(tile, d)
}
Expand Down

0 comments on commit ebd5d12

Please sign in to comment.