private void btn123(object sender, EventArgs e)
        {
            switch ((sender as Button).Text)
            {
            case "Quick Sort Algorithm Simulation":
                QuickSort frmquick = new QuickSort();
                GlobalClass.CheckMdiChildren(frmquick);
                break;

            case "Counting Sort Algorithm Simulation":
                CountingSort frmcount = new CountingSort();
                GlobalClass.CheckMdiChildren(frmcount);
                break;

            case "Radix Sort Algorithm Simulation":
                RadixSort frmradix = new RadixSort();
                GlobalClass.CheckMdiChildren(frmradix);
                break;

            case "Dice Throw Problem":
                DiceThrow frmdicethrow = new DiceThrow();
                GlobalClass.CheckMdiChildren(frmdicethrow);
                break;

            case "Travelling Salesman Problem":
                TSP frmTSP = new TSP();
                GlobalClass.CheckMdiChildren(frmTSP);
                break;
            }
        }
        private void ClearButton_Click(object sender, EventArgs e)
        {
            // clear the buckets
            for (int i = 0; i < DieRollY.Length; i++)
            {
                DieRollY[i] = 0;
            }

            for (int i = 0; i < DiceTotalY.Length; i++)
            {
                DiceTotalY[i] = 0;
            }

            // reset rolls counter
            NumberOfRolls = 0;

            // reset the chart with the zeroed buckets
            DieRollChart.Series["Die Rolls"].Points.DataBindXY(DieRollX, DieRollY);
            DiceThrowChart.Series["Dice Totals"].Points.DataBindXY(DiceTotalX, DiceTotalY);

            RollTotalLabel.Text = string.Format("{0} Total Rolls", NumberOfRolls);

            // reenable the DefaultEventListener in the library
            DiceThrow.EnableDefaultEventListener();

            // log it
            iMELLogger.LogInformation("ClearButton_Click completed.");
        }
Example #3
0
 public void DiceThrow_Smoke_Test()
 {
     Assert.AreEqual(0, DiceThrow.WaysToGetSum(1, 2, 4));
     Assert.AreEqual(2, DiceThrow.WaysToGetSum(3, 2, 2));
     Assert.AreEqual(21, DiceThrow.WaysToGetSum(8, 3, 6));
     Assert.AreEqual(4, DiceThrow.WaysToGetSum(5, 2, 4));
     Assert.AreEqual(6, DiceThrow.WaysToGetSum(5, 3, 4));
 }
Example #4
0
 public byte GetDamage()
 {
     if (DiceThrow._1K6() == 6)
     {
         return(1);
     }
     return(0);
 }
Example #5
0
 // Use this for initialization
 void Start()
 {
     DiceValues = new List <int>();
     am         = GetComponent <AchievementsManager>();
     players    = GameObject.FindGameObjectsWithTag("Player");
     BlueGameObject.SetActive(false);
     GreenGameObject.SetActive(false);
     RedGameObject.SetActive(false);
     YellowGameObject.SetActive(false);
     if (!PlayerSelection.isNetworkedGame)
     {
         GameObject obj = (GameObject)Instantiate(NormalDice, DicePosition.transform.position, Quaternion.identity);
         dice = obj.GetComponent <DiceThrow>();
         InitializeGame();
     }
 }
Example #6
0
 // Use this for initialization
 void Start()
 {
     Debug.Log("player info : " + PlayerSelection.playerInfo);
     DiceValues = new List <int>();
     am         = GetComponent <AchievementsManager>();
     players    = GameObject.FindGameObjectsWithTag("Player");
     BlueGameObject.SetActive(false);
     GreenGameObject.SetActive(false);
     RedGameObject.SetActive(false);
     YellowGameObject.SetActive(false);
     redHomeCount = blueHomeCount = yellowHomeCount = greenHomeCount = -11;
     if (!PlayerSelection.isNetworkedGame)
     {
         GameObject obj = (GameObject)Instantiate(NormalDice, DicePosition.transform.position, Quaternion.identity);
         dice = obj.GetComponent <DiceThrow>();
         Invoke("InitializeGame", 1f);
     }
 }
Example #7
0
        public Game(string inPlayer)
        {
            _selectedDices = new bool[Constants.NUMBER_OF_DICES];
            _diceRoller = new DiceRoller();

            _currentDiceThrow = DiceThrow.FIRST;
            _turnEnded = false;

            Player = inPlayer;
            UnselectDice();

            _msg = new string[]
                {
                    "Throw the dice! Throw the dice! Throw the dice!",
                    "You threw three times. Enter the points!",
                    "You must announce entry!",
                    "Enter the points!!!",
                    "Roll dice first!!!",
                    "You've selected an improper field!!"
                };
        }
        /// <summary>
        /// Toggle the status of the DefaultEventListener in the ETW logger to supress or enable
        /// ETW messages on attached debuggers like the Visual Studio debugger on the Output window.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void DefaultEventListenerButton_Click(object sender, EventArgs e)
        {
            // toggle the status
            DefaultEventListenerEnabled = !DefaultEventListenerEnabled;

            if (DefaultEventListenerEnabled)
            {
                DiceThrow.EnableDefaultEventListener();

                DefaultEventListenerButton.Text = "Disable DefaultEventListener";
            }
            else
            {
                // Suppress ETW DefaultEventListener messages from appearing
                // on attached debuggers. They will still be logged by the EventListenerStub's
                // iMELLogger in Program.cs, but won't appear Visual Studio Output window twice.
                DiceThrow.DisableDefaultEventListener();

                DefaultEventListenerButton.Text = "Enable DefaultEventListener";
            }
        }
 public override byte GetPainToleranceModifier() => (byte)(DiceThrow._1K6() + 5);
 public byte GetDamage() => (byte)DiceThrow._1K2();
Example #11
0
        public void InputValue(ColumnTypes column, LayerTypes layer, FieldTypes field, int[] diceNumbers, DiceThrow diceThrow)
        {
            if (column == ColumnTypes.ANNOUNCEMENT && !_announced)
            {
                if (diceThrow == DiceThrow.SECOND)
                {
                    Columns[column].InputValues(layer, field, diceNumbers);
                    _announced = true;
                }
                else
                {
                    throw new InaccessibleFieldException("The field is unavailable.");
                }
            }
            else if (_announced && column != ColumnTypes.ANNOUNCEMENT)
            {
                throw new InaccessibleFieldException("The field is unavailable.");
            }
            else
            {
                Columns[column].InputValues(layer, field, diceNumbers);
                _announced = false;
            }

            NotifyObservers();
        }
 public byte GetDamage() => (byte)(DiceThrow._1K6_RangedAttack() + 1);
Example #13
0
 private void NextTurn()
 {
     _currentDiceThrow = DiceThrow.FIRST;
     _turnEnded = false;
     UnselectDice();
 }
Example #14
0
        private DiceThrow IncreaseThrowCount()
        {
            int throwCount = (int)_currentDiceThrow;
            if (throwCount == MAXIMUM_THROWS)
            {
                _currentDiceThrow = DiceThrow.FIRST;
                _turnEnded = true;
            }
            else
            {
                throwCount++;
                _currentDiceThrow = (DiceThrow)throwCount;
            }

            return _currentDiceThrow;
        }
 public byte GetDamage() => (byte)(DiceThrow._1K6() + 1);
 public byte GetDamage() => (byte)(DiceThrow._1K10() + 2);
 public byte GetDamage() => (byte)(DiceThrow._2K6() + 2);
Example #18
0
 public byte GetDamage() => (byte)DiceThrow._3K6();
 public byte GetDamage() => (byte)DiceThrow._1K3_RangedAttack();
 public override byte GetPainToleranceModifier() => (byte)DiceThrow._1K5();
 public byte GetDamage() => (byte)(DiceThrow._2K10());