public static ulong NextMask(this IGenerator rnd, FreeCells cells) { var index = cells[rnd.Next(cells.Count)]; ulong mask = rnd.NextCell() << (index * 4); return(mask); }
public Board FillEmptySpot(IGenerator rnd) { var freeCells = FreeCells.FromBoard(this); if (freeCells.Any()) { var bits = Bits | rnd.NextMask(freeCells); return(new Board(bits, Score)); } else { return(Empty); } }