ComputeDistance() public static method

public static ComputeDistance ( Vector v1, Vector v2 ) : double
v1 Vector
v2 Vector
return double
Esempio n. 1
0
        // Where's the randomness? Possibilities:
        // Category the actions and pick one randomly from the cat's set of actions (or approximate by some probability distribution etc.)
        // Sort a list from best to worst distances and pick randomly from that list (top N candidates - uniform random or normal)

        public override int TimeOnDoubleOffer(GameState gamestate, DoubleResponseHint hint)
        {
            Vector v = ToDoubleInput(gamestate, hint);

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

            doubles.Sort(Compare);

            return((int)doubles[0].Key.Time);
        }
Esempio n. 2
0
        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);
        }