Exemple #1
0
        public static bool IsWinning(Red7Game game, Color canvasColorPlayed)
        {
            var colorRule    = ColorRules.GetRuleByColor(canvasColorPlayed);
            var activePlayer = game.Players.Where(x => x.Active).First();

            var activePlayerPalette = activePlayer.Palette.CloneJson();
            var opponentPalettes    = game.Players.Where(x => !x.Active).Select(y => y.Palette).ToList();

            return(IsWinningPalette(canvasColorPlayed, activePlayerPalette, opponentPalettes, colorRule));
        }
Exemple #2
0
        static void Main(string[] args)
        {
            var activePalette = new Palette(1)
            {
                Cards = new List <Card>
                {
                    new Card
                    {
                        Color = Color.Orange,
                        Value = 2
                    },
                    new Card
                    {
                        Color = Color.Blue,
                        Value = 4
                    },
                    new Card
                    {
                        Color = Color.Indigo,
                        Value = 5
                    },
                    new Card
                    {
                        Color = Color.Blue,
                        Value = 2
                    },
                    new Card
                    {
                        Color = Color.Green,
                        Value = 5
                    },
                }
            };

            var opponentPalettes = new List <Palette>();

            opponentPalettes.Add(new Palette(2)
            {
                Cards = new List <Card>
                {
                    new Card
                    {
                        Color = Color.Green,
                        Value = 4
                    },
                    new Card
                    {
                        Color = Color.Violet,
                        Value = 2
                    },
                    new Card
                    {
                        Color = Color.Yellow,
                        Value = 2
                    },
                    new Card
                    {
                        Color = Color.Red,
                        Value = 5
                    },
                    new Card
                    {
                        Color = Color.Yellow,
                        Value = 6
                    },
                }
            });
            opponentPalettes.Add(new Palette(3)
            {
                Cards = new List <Card>
                {
                    new Card
                    {
                        Color = Color.Green,
                        Value = 5
                    },
                    new Card
                    {
                        Color = Color.Violet,
                        Value = 5
                    },
                    new Card
                    {
                        Color = Color.Yellow,
                        Value = 1
                    },
                    new Card
                    {
                        Color = Color.Red,
                        Value = 7
                    },
                    new Card
                    {
                        Color = Color.Green,
                        Value = 6
                    },
                }
            });

            GameLogic.IsWinningBlueRule(activePalette, opponentPalettes);

            GameLogic.IsWinningPalette(Color.Orange, activePalette, opponentPalettes, ColorRules.GetRuleByColor(Color.Orange));

            Console.ReadLine();
        }
Exemple #3
0
        public static bool IsWinning(Color canvasColor, Palette activePlayerPalette, List <Palette> opponentPalettes)
        {
            var colorRule = ColorRules.GetRuleByColor(canvasColor);

            return(IsWinningPalette(canvasColor, activePlayerPalette, opponentPalettes, colorRule));
        }