Files

22 lines
598 B
Go
Raw Permalink Normal View History

2026-10-25 02:51:07 +00:00
// Package cell represents a single cell in a maze grid.
package cell
import (
"code.chimeric.al/dwrz/minotaur/pkg/maze/direction"
)
// Cell is a bitmask of open passages from a cell to its neighbors.
// Bit d (1 << d) is 1 when the passage in direction d is open, and 0 when a
// wall blocks that direction.
type Cell uint8
// HasDirection reports whether the passage in direction d is open.
func (c Cell) HasDirection(d direction.Direction) bool {
return c&(1<<d) != 0
}
// SetDirection opens the passage in direction d.
func (c *Cell) SetDirection(d direction.Direction) {
*c |= 1 << d
}