コード例 #1
0
        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;
            }
        }
コード例 #2
0
        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.");
        }
コード例 #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));
 }
コード例 #4
0
 public byte GetDamage()
 {
     if (DiceThrow._1K6() == 6)
     {
         return(1);
     }
     return(0);
 }
コード例 #5
0
ファイル: GameManager.cs プロジェクト: nilakmacle/Board-Game
 // 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();
     }
 }
コード例 #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);
     }
 }
コード例 #7
0
ファイル: Game.cs プロジェクト: Joop7/yamb-game
        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!!"
                };
        }
コード例 #8
0
        /// <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";
            }
        }
コード例 #9
0
 public override byte GetPainToleranceModifier() => (byte)(DiceThrow._1K6() + 5);
コード例 #10
0
 public byte GetDamage() => (byte)DiceThrow._1K2();
コード例 #11
0
ファイル: YambTable.cs プロジェクト: Joop7/yamb-game
        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();
        }
コード例 #12
0
 public byte GetDamage() => (byte)(DiceThrow._1K6_RangedAttack() + 1);
コード例 #13
0
ファイル: Game.cs プロジェクト: Joop7/yamb-game
 private void NextTurn()
 {
     _currentDiceThrow = DiceThrow.FIRST;
     _turnEnded = false;
     UnselectDice();
 }
コード例 #14
0
ファイル: Game.cs プロジェクト: Joop7/yamb-game
        private DiceThrow IncreaseThrowCount()
        {
            int throwCount = (int)_currentDiceThrow;
            if (throwCount == MAXIMUM_THROWS)
            {
                _currentDiceThrow = DiceThrow.FIRST;
                _turnEnded = true;
            }
            else
            {
                throwCount++;
                _currentDiceThrow = (DiceThrow)throwCount;
            }

            return _currentDiceThrow;
        }
コード例 #15
0
 public byte GetDamage() => (byte)(DiceThrow._1K6() + 1);
コード例 #16
0
 public byte GetDamage() => (byte)(DiceThrow._1K10() + 2);
コード例 #17
0
 public byte GetDamage() => (byte)(DiceThrow._2K6() + 2);
コード例 #18
0
 public byte GetDamage() => (byte)DiceThrow._3K6();
コード例 #19
0
 public byte GetDamage() => (byte)DiceThrow._1K3_RangedAttack();
コード例 #20
0
 public override byte GetPainToleranceModifier() => (byte)DiceThrow._1K5();
コード例 #21
0
 public byte GetDamage() => (byte)(DiceThrow._2K10());