public int CardToPlay(CrazyEightsSaveInfo saveroot) { CrazyEightsPlayerItem player = saveroot.PlayerList.GetWhoPlayer(); DeckRegularDict <RegularSimpleCard> list = player.MainHandList.Where(x => x.Value != EnumCardValueList.Eight && x.Suit == saveroot.CurrentSuit).ToRegularDeckDict(); if (list.Count != 0) { return(list.GetRandomItem().Deck); } list = player.MainHandList.Where(x => x.Value != EnumCardValueList.Eight && x.Value == saveroot.CurrentNumber).ToRegularDeckDict(); if (list.Count == 1) { return(list.Single().Deck); } if (list.Count != 0) { return(FindBestCard(list)); } list = player.MainHandList.Where(x => x.Value == EnumCardValueList.Eight).ToRegularDeckDict(); if (list.Count != 0) { return(list.GetRandomItem().Deck); } return(0);//0 means needs to draw. }