private static bool ChooseRemainingFreeSlot(IEnumerable <GridSlot> slots, Symbol.SymbolType symbolType, out GridSlot chosenSlot)
        {
            var list = slots.ToList();

            if (list.Count(s => !s.IsFree && s.Symbol.Value.Type == symbolType) == 2 && list.Any(s => s.IsFree))
            {
                //get index of slot in row that is not yet full, we are gonna choose this one
                chosenSlot = list.First(s => s.IsFree);
                return(true);
            }

            chosenSlot = null;
            return(false);
        }
Ejemplo n.º 2
0
    //validate dice content (if many players)
    public ActionType JudgeActions(Symbol.SymbolType[] dice)
    {
        bool verdict = Resolve(dice);

        if (verdict)
        {
            switch (type)
            {
            case ConditionType.Discover:
                return(ActionType.Discover);

            case ConditionType.Enter:
                return(ActionType.Move);

            case ConditionType.MinorLock:
                return(ActionType.OpenMinorLock);

            case ConditionType.BigLock:
                Symbol.SymbolType type = conditionElements[0];
                int typeCount          = 0;
                foreach (var s in dice)
                {
                    if (s == type)
                    {
                        ++typeCount;
                    }
                }

                if (typeCount >= 10)
                {
                    return(ActionType.OpenBigLock);
                }

                if (typeCount >= 7)
                {
                    return(ActionType.OpenNormalLock);
                }

                return(ActionType.OpenMinorLock);

            case ConditionType.Exit:
                return(ActionType.Exit);
            }
        }

        return(ActionType.None);
    }
Ejemplo n.º 3
0
    public ESCCondition(ESCMaze m, ConditionType conditionType)
    {
        maze = m;
        type = conditionType;

        Symbol.SymbolType lockCondition = Symbol.RollLockCondition();
        switch (type)
        {
        case ConditionType.Discover:
            conditionElements = new Symbol.SymbolType[2] {
                Symbol.SymbolType.Human, Symbol.SymbolType.Human
            };
            break;

        case ConditionType.Enter:
            conditionElements = new Symbol.SymbolType[2];
            for (var i = 0; i < 2; i++)
            {
                conditionElements[i] = Symbol.RollCondition();
            }
            break;

        case ConditionType.MinorLock:
        case ConditionType.BigLock:
            conditionElements = new Symbol.SymbolType[4];
            for (var i = 0; i < 4; i++)
            {
                conditionElements[i] = lockCondition;
            }
            break;

        case ConditionType.Exit:
            conditionElements = CalcExitCondition();
            break;
        }
    }