예제 #1
0
        //Return true is already exist
        // false if non-exist
        public override bool addToMap(Playfield state)
        {
            float key = getHashkey(state);

            //Helpfunctions.Instance.logg("end key = " + key);
            if (TTable.ContainsKey(key))
            {
                foreach (Playfield existState in TTable[key])
                {
                    if (existState.isHandEqual(state, true))
                    {
                        return(true);
                    }
                }
                if (TTable[key][0].getBoardValue(true) < state.getBoardValue(true))
                {
                    //Helpfunctions.Instance.logg("orig board " + TTable[key][0].getBoardValue());
                    //TTable[key][0].debugMinions();
                    //Helpfunctions.Instance.logg("new board " + state.getBoardValue());
                    //state.debugMinions();
                    TTable[key][0] = state;
                }
                return(false);
            }
            else
            {
                TTable.Add(key, new List <Playfield>());
                TTable[key].Add(state);
            }
            return(false);
        }
예제 #2
0
        //Return true is already exist
        // false if non-exist
        public override bool addToMap(Playfield state)
        {
            float key = getHashkey(state);

            //Helpfunctions.Instance.logg("key:" + key);
            //if ("" + key == "4140817")
            //{
            //    int debug = 1;
            //    state.debugMinions();
            //}
            //if (state.playerFirst.ownMaxMana == 3)
            //{
            //    int debug = 1;
            //}
            if (TTable.ContainsKey(key))
            {
                foreach (Playfield existState in TTable[key])
                {
                    if (existState.isEqual(state, true))
                    {
                        return(true);
                    }
                }
                TTable[key].Add(state);
                return(false);
                //state.printBoard();
            }
            else
            {
                TTable.Add(key, new List <Playfield>());
                TTable[key].Add(state);
            }
            return(false);
        }