public void SortOtherCards() { DeckRegularDict <RegularSimpleCard> output = new DeckRegularDict <RegularSimpleCard>(); _gameContainer !.OtherPlayer !.MainHandList.ForEach(thisCard => { RegularSimpleCard newCard = new RegularSimpleCard(); newCard.Populate(thisCard.Deck); newCard.IsUnknown = true; output.Add(newCard); }); output.ShuffleList(); _model.OpponentCards1 !.HandList.ReplaceRange(output); }
public MoveInfo MoveToMake() { CustomBasicList <MoveInfo> newList = new CustomBasicList <MoveInfo>(); _gameContainer.SingleInfo !.MainHandList.ForEach(thisCard => { newList.AddRange(MoveList(thisCard.Deck)); MoveInfo thisMove = new MoveInfo(); thisMove.ToDiscard = true; thisMove.Deck = thisCard.Deck; newList.Add(thisMove); }); return(newList.GetRandomItem()); }
private static int ComputerUse(RackoMainGameClass game, int card) { int maxDiffs; maxDiffs = game.PlayerList.Count() + 2; int possNum = 0; int previousCard = 0; int prevPossNum = 0; game.SingleInfo !.MainHandList.ForEach(x => { possNum += maxDiffs; if (x.Value > prevPossNum && x.Value < possNum && x.WillKeep == false) { x.WillKeep = true; } prevPossNum = possNum; }); possNum = 0; prevPossNum = 0; int x = 0; foreach (var y in game.SingleInfo.MainHandList) { x++; possNum += maxDiffs; if (y.WillKeep == false && card >= possNum && card <= prevPossNum) { return(x); } if (y.WillKeep == false && previousCard > possNum && card <= possNum) { return(x); } prevPossNum = possNum; previousCard = y.Value; } return(0); }
public static int DominoToPlay(out int whichOne, DominosRegularMainGameClass mainGame, GameBoardCP gameboard) { whichOne = 0; //until proven otherwise. CustomBasicList <MoveInfo> moveList = new CustomBasicList <MoveInfo>(); mainGame.SingleInfo !.MainHandList.ForEach(thisDomino => { for (int x = 1; x <= 2; x++) { if (gameboard.IsValidMove(x, thisDomino)) { MoveInfo thisMove = new MoveInfo(); thisMove.Deck = thisDomino.Deck; thisMove.WhichOne = x; thisMove.Points = thisDomino.Points; moveList.Add(thisMove); } } }); if (moveList.Count == 0) { return(0); } moveList.Sort(); var finalMove = moveList.First(); int howMany = moveList.Count(items => items.Deck == finalMove.Deck); if (howMany == 1) { whichOne = finalMove.WhichOne; return(finalMove.Deck); } RandomGenerator rs = mainGame.MainContainer.Resolve <RandomGenerator>(); whichOne = rs.GetRandomNumber(2); return(finalMove.Deck); }