public void InitialiseInstance(SolverNode parent, VectorInt2 playerBefore, VectorInt2 push, IBitmap crateMap, IBitmap moveMap) { base.Parent = parent; base.Clear(); // Check init/use should have a NEW id to avoid same-ref bugs; it is effectively a new instance solverNodeId = Interlocked.Increment(ref nextId); this.playerBefore = new VectorByte2(playerBefore); this.push = push switch { (0, 0) => (byte)0, (0, -1) => (byte)1, (0, 1) => (byte)2, (-1, 0) => (byte)3, (1, 0) => (byte)4, _ => throw new ArgumentOutOfRangeException(push.ToString()) }; this.crateMap = crateMap; this.moveMap = moveMap; this.status = (byte)SolverNodeStatus.UnEval; unchecked { var hashCrate = CrateMap.GetHashCode(); var hashMove = MoveMap.GetHashCode(); #if NET47 hash = hashCrate ^ (hashMove << (MoveMap.Width / 2)); #else hash = HashCode.Combine(hashCrate, hashMove); #endif } }
public BitmapByteSeq(VectorInt2 size, byte[] memory) { this.memory = memory; this.size = new VectorByte2(size); }
public BitmapByteSeq(VectorInt2 size) { this.size = new VectorByte2(size); this.memory = new byte[SizeInBytes()]; }