public override int TimeOnTurnChanged(GameState gamestate, DoubleHint doubleHint, ResignHint resignHint)
 {
     return 0;
 }
Example #2
0
 public abstract int TimeOnTurnChanged(GameState gamestate, DoubleHint doubleHint, ResignHint resignHint);
 public override int TimeOnTurnChanged(GameState gamestate, DoubleHint doubleHint, ResignHint resignHint)
 {
     return random.Next(500, 1000);
 }
        public override int TimeOnTurnChanged(GameState gamestate, DoubleHint doubleHint, ResignHint resignHint)
        {
            // Player has captured pieces, think less time.
            if (gamestate.Board.CapturedCount(gamestate.PlayerOnRoll) > 0)
                return (int)(coefficient * Gaussian.Next(700, 250, 20000, 500, 2.0));

            if (!gamestate.CanDouble())
                return (int)(coefficient * Gaussian.Next(400, 500, 20000, 1500, 2.0));

            //  Parameter   Values
            //  Mean        1000 ms
            //  Minimum     500 ms
            //  Maximum     20000 ms
            //  Deviation   2.0 (95.4% are within 2000 ms from mean)
            return (int)(coefficient * Gaussian.Next(1000, 1000, 20000, 1700, 2.0));
        }
        private Vector ToTurnInput(GameState gs, DoubleHint hint)
        {
            double ratio = 0.0;
            Vector vector = null;

            if (gs.CanDouble())
            {
                if (gs.GameType == GameType.Match)
                {
                    ratio = System.Math.Min(
                        (System.Math.Max(gs.Score(0), gs.Score(1)) + gs.Cube.Value) / (double)gs.MatchTo,
                        1.0);
                }

                if (gs.GameType == GameType.Money)
                {
                    ratio = System.Math.Min(gs.Cube.Value * gs.Stake / (double)gs.Limit, 1.0);
                }

                vector = new Vector(System.Math.Abs(System.Math.Min(hint.DoubleTakeEq, hint.DoublePassEq) - hint.NoDoubleEq),
                                        ratio, 100.0);
            }
            else
            {
                vector = new Vector(0.0, ratio, 0.0);
            }

            return vector;
        }
        public override int TimeOnTurnChanged(GameState gamestate, DoubleHint doubleHint, ResignHint resignHint)
        {
            Vector v = ToTurnInput(gamestate, doubleHint);

            foreach (KeyValuePair<GameStateAction, Vector> gv in turns)
            {
                gv.Value.Distance = Vector.ComputeDistance(gv.Value, v);
            }

            turns.Sort(Compare);

            foreach (KeyValuePair<GameStateAction, Vector> gv in turns)
            {
                Console.WriteLine(gv.Key.Time + " " + gv.Value.Distance);
            }
            Console.WriteLine(turns.Count);

            return (int)turns[0].Key.Time;
        }
        public override int TimeOnTurnChanged(GameState gamestate, DoubleHint doubleHint, ResignHint resignHint)
        {
            if (random.Next(15) == 0)
                return 300 + random.Next(800);

            return 200;
        }