Пример #1
0
 public void sendQuestion(string ip)
 {
     newConnection(ip, "MOVE");
     try {
         this.formatter.Serialize(this.stream, this.game.getNCP());
         this.stream.Flush();
         Lexicon.Move m = (Lexicon.Move) this.formatter.Deserialize(this.stream);
         this.game.desk.Play(m);
     } catch (Exception e) {
         Console.WriteLine(e.Message);
     }
 }
Пример #2
0
        public virtual bool DoMove(Lexicon.Move m)
        {
            /* Check cross check
             * Calcul score */
            if (!this.game.desk.AnalyzeMove(m))
            {
                return(false);
            }

            /* Is connected with rest of stone? */
            if (!this.game.desk.Connect(m))
            {
                return(false);
            }



            // LOG
            if (Scrabble.Game.InitialConfig.log)
            {
                Console.Out.Write("ROUND {1}\tPLAYER {0}\tRACK: ", this.Name, this.game.Round);
                foreach (char c in this.Rack)
                {
                    Console.Out.Write("{0} ", c);
                }
                Console.Out.WriteLine();
            }

            if (!this.game.desk.Play(m))
            {
                return(false);
            }
            else
            {
                if (m.Score > game.bestMove.Score)
                {
                    game.bestMove = m;
                }
                if (m.Score > this.bestMove.Score)
                {
                    this.bestMove = m;
                }
                WriteToLog(m);
            }
            return(true);
        }
Пример #3
0
        public override bool DoMove(Lexicon.Move m)
        {
            /* Check cross check
             * Calcul score */
            if (!game.desk.AnalyzeMove(m))
            {
                return(false);
            }

            /* Is connected with rest of stone? */
            if (!game.desk.Connect(m))
            {
                return(false);
            }

            lock (Scrabble.Game.InitialConfig.game.gameLock) {
                Scrabble.Game.InitialConfig.game.Window.DisableButtons();
                Scrabble.Game.InitialConfig.game.move     = m;
                Scrabble.Game.InitialConfig.game.turnDone = true;
                Scrabble.Game.InitialConfig.game.clientThread.Interrupt();
            }
            return(true);
        }