Example #1
0
        public override int playI(QuatroField field, InterfaceNotifier notifier)
        {
            GameCoords click;

            while (true)
            {
                click = notifier.getClick();

                if (click == null)
                    Thread.Sleep(100);
                else
                    break;
            }

            return click.column;
        }
Example #2
0
        public override int playI(QuatroField field, InterfaceNotifier notifier)
        {
            int play = rdm.Next(9);

            //Change the talk every time the monkey plays
            int choice = rdm.Next(3);
            switch(choice)
            {
                case 0:
                    talk = "YOU ARE GONNA LOOSE!!!";
                    break;
                case 1:
                    talk = "MuuhaAHahaham Noob!";
                    break;
                case 2:
                    talk = "You are so bad! You Lost IT!!";
                    break;
            }

            //Notify visuals the talk has changed
            NotifyChanged();

            return play;
        }
Example #3
0
        public override int playI(QuatroField field, InterfaceNotifier notifier)
        {
            int play;
            int myNumber = field.PlayerTurn;
            int opNumber = myNumber == 1 ? 2 : 1;

            play = winNext(myNumber, field);
            if (play != -1)
            {
                talk = "Eu vou ganhar na coluna " + play;
                NotifyChanged();
                return play;
            }

            play = winNext(opNumber, field);
            if (play != -1)
            {
                talk = "Tu ias ganhar na coluna " + play;
                NotifyChanged();
                return play;
            }

            List<int> moves = triar(possibleMoves(field), myNumber, opNumber, field);

            return moves[rdm.Next(moves.Count)];
        }
Example #4
0
        public override int playI(QuatroField field, InterfaceNotifier notifier)
        {
            playing = true;
            lock(valuesLock)
            {
                for (int i = 0; i < values.Length; i++)
                    values[i] = -1;
            }
            NotifyChanged();

            int bestPlay = search(field);

            playing = false;
            lock(valuesLock)
            {
                for (int i = 0; i < values.Length; i++)
                    values[i] = jogadas[i];
            }
            NotifyChanged();

            return bestPlay;
        }
Example #5
0
 public override int playI(QuatroField field, InterfaceNotifier notifier)
 {
     return rdm.Next(9);
 }