Ejemplo n.º 1
0
        /* Sets the processor and the size of the tetris view. */
        public void InitView()
        {
            /* If no external processor has been set, create a new one. */
            if (Processor == null)
            {
                Processor = new TetrisProcessor();
            }

            Bot = new TetrisBot(Processor);

            /* Prevent flickering by double buffering the user control. */
            DoubleBuffered = true;

            /* Set all initial values. */

            BorderPen = new Pen(DefaultBorderColor, DefaultBorderWidth);

            BackColor              = DefaultBackColor;
            BlockColor             = DefaultBlockColor;
            BotBlockColor          = DefaultBotBlockColor;
            BotLookAheadBlockColor = DefaultBotLookAheadBlockColor;
            BorderColor            = DefaultBorderColor;
            BorderWidth            = DefaultBorderWidth;

            /* Add a listener to the grid update event. */
            Processor.GridUpdateEvent += Processor_UpdateEvent;
            /* Preview the first piece. */
            Processor.PreviewNextPiece();
        }
Ejemplo n.º 2
0
        public TetrisBot(TetrisProcessor processor)
        {
            /* Assign the tetris processor. */
            Processor = processor;

            /* Default values. */
            BestMoveDelay = 100;
            GridMoveDelay = 20;

            PrioritizeTetrisses        = true;
            ForceNormalPlayFieldHeight = 16;
        }