コード例 #1
0
        public static bool Validate(int slotIdSource, int slotIdDestination, Turn turn)
        {
            //if(turn == Turn.Black)
            //{
            //    if(slotIdSource-slotIdDestination <= 0)
            //    {
            //        return true;
            //    }
            //    return false;
            //}
            //else
            //{
            //    if (slotIdSource - slotIdDestination >= 0)
            //    {
            //        return true;
            //    }
            //    return false;
            //}

            Step playerStep = StepsConverter.ConvertToStep(slotIdSource, slotIdDestination, turn);

            if (playerStep.Value >= 0)
            {
                return(true);
            }
            return(false);
        }
コード例 #2
0
        public static void Update(int slotIdSource, int slotIdDestination, List <Step> steps, Turn turn)
        {
            Step stepPlayed      = StepsConverter.ConvertToStep(slotIdSource, slotIdDestination, turn);
            Step stepMatchToCube = steps.Where(s => s.Value == stepPlayed.Value).FirstOrDefault();

            if (stepMatchToCube == null)
            {
                throw new Exception("somthing wrong with the stepsLeftUpdater");
            }
            steps.Remove(stepMatchToCube);
        }
コード例 #3
0
        public static bool Validate(int slotIdSource, int slotIdDestination, Turn turn, List <Step> Steps)
        {
            var playerStep = StepsConverter.ConvertToStep(slotIdSource, slotIdDestination, turn);

            foreach (var step in Steps)
            {
                if (step.Value == playerStep.Value || step.Value > playerStep.Value)
                {
                    return(true);
                }
            }
            return(false);
        }