예제 #1
0
        //-----------------------------------------------------------------------------
        // finalize
        //-----------------------------------------------------------------------------
        //static public void finalize()
        //{
        //    while (true)
        //    {
        //        Thread.Sleep(500);
        //        prepareGlobalSendFrameToConsoleStrBuilder();
        //        printVector();
        //    }
        //}


        //-----------------------------------------------------------------------------
        // Main
        //
        //   Only draw one edge and flip due to symmetry?
        //       https://youtu.be/6nUMiJfHLSA
        //------------------------------------------------------------------------------
        public static int MainFunction(bool isPlayer = true)
        {
            CALLED++;
            initializeFrameBuffer(' '); // M is the widest, this creates the most symmetrical square
            SubGrid infoBox = new SubGrid(42, 1, 1, 0);

            infoBox.sendTextToBuffer("Get as close as you can to the right edge.");
            infoBox.sendToGlobalBuffer();
            //sendFrameToConsole();

            diceWidget diceWidget = new diceWidget(40, 1, 0, 0); // Currently 40 long, can be dynamicaly adjusted
            Thread     thread     = new Thread(diceWidget.activate);

            thread.Start();

            while (diceWidget.isActive())
            {
                sendFrameToConsole();
            }

            //thread.Interrupt();

            return(diceWidget.evaluateResults());
            //return 6;
        }