private AbstractCombinatoricsPuzzleCardsDeck(AbstractCombinatoricsOrder order) { DeckID = System.DateTime.Now.ToOADate(); PrimeOrder = order; int orderInt = (int)order; int count = orderInt * orderInt + orderInt + 1; Deck = new List <AbstractCombinatoricsPuzzleCard>(count); DeadCards = new List <AbstractCombinatoricsPuzzleCard>(count); for (int index = 0; index < count; index++) { Deck.Add(new AbstractCombinatoricsPuzzleCard(DeckID, order)); } // make the cards int deckIndex = 0; // first cards (order * order) for (int i = 0; i < orderInt; i++) { for (int j = 0; j < orderInt; j++) { for (int k = 0; k < orderInt; k++) { Deck[deckIndex].Lines.Add((byte)((i * k + j) % orderInt * orderInt + k)); } Deck[deckIndex].Lines.Add((byte)(orderInt * orderInt + i)); deckIndex++; } } // following cards (order) for (int i = 0; i < orderInt; i++) { for (int j = 0; j < orderInt; j++) { Deck[deckIndex].Lines.Add((byte)(j * orderInt + i)); } Deck[deckIndex].Lines.Add((byte)(orderInt * orderInt + orderInt)); deckIndex++; } // final card for (int i = 0; i <= orderInt; i++) { Deck[deckIndex].Lines.Add((byte)(orderInt * orderInt + i)); } // shuffle it Shuffle(); }
public static AbstractCombinatoricsPuzzleCardsDeck CreateNewDeck(AbstractCombinatoricsOrder order) { return(new AbstractCombinatoricsPuzzleCardsDeck(order)); }
internal AbstractCombinatoricsPuzzleCard(double id, AbstractCombinatoricsOrder order) { DeckID = id; Lines = new List <byte>((int)order + 1); }