예제 #1
0
 protected override long GetCalculationResult()
 {
     var num = new LongNum("1");
     for (int i = 0; i <= 1000 - 1; i++)
     {
         num = num.Add(num);
     }
     this.Print("{0}", num);
     return num.DigitSum;
 }
예제 #2
0
        protected override long GetCalculationResult()
        {
            var num = new LongNum("1");

            for (int i = 0; i <= 1000 - 1; i++)
            {
                num = num.Add(num);
            }
            this.Print("{0}", num);
            return(num.DigitSum);
        }
예제 #3
0
        protected override long GetCalculationResult()
        {
            const int max = 1000;
            var       res = new LongNum(0);

            for (int i = 1; i <= max; i++)
            {
                res = res.Add(new LongNum(new LongNum(i).Pow(i).Last(10)));
            }

            var last = res.Last(10);

            Print("Digits: {0}", last);
            return(long.Parse(last));
        }
예제 #4
0
        protected override long GetCalculationResult()
        {
            var     c       = 2;
            var     fib     = new LongNum("1");
            var     prevFib = new LongNum("1");
            LongNum ppFib;

            while (fib.Length < 1000)
            {
                c++;
                ppFib   = prevFib;
                prevFib = fib;
                fib     = fib.Add(ppFib);
                Print("{0,3} - {1,50}", c, fib);
            }

            return(c);
        }
예제 #5
0
        // Update is called once per frame
        void Update()
        {
            dust += dustPerSecund * Time.deltaTime;
            float p = (float)dust / terraformPrice;
            Color c = Color.Lerp(startTint, endtint, p);

            long d = (long)dust;

            if (gameState == 0)
            {
                if (d >= 2)
                {
                    gameState++;
                    dustCounterObject.SetActive(true);
                }
            }
            else if (gameState == 1)
            {
                if (d >= (1 / 3) * crystalPrice)
                {
                    gameState++;
                    crystalCounterObject.SetActive(true);
                    crystalBuyButton.gameObject.SetActive(true);
                }
            }
            else if (gameState == 2)
            {
                if (d >= (1 / 5) * friendPrice && crystals > 0)
                {
                    gameState++;
                    friendsCounterObject.SetActive(true);
                    friendsBuyButton.gameObject.SetActive(true);
                }
            }
            else if (gameState == 3)
            {
                if (d >= (1 / 10) * nicestuffPrice && friends > 0)
                {
                    gameState++;
                    niceStuffBuyButton.gameObject.SetActive(true);
                }
            }
            else if (gameState == 4)
            {
                if (niceStuffLevel >= niceStuffDescriptions.Length - 1)
                {
                    gameState++;                     //end-game
                    terraformMarsButton.gameObject.SetActive(true);
                    leaveMarsButton.gameObject.SetActive(true);
                    leaveMarsButton.interactable = true;
                }
            }

            crystalBuyButton.interactable    = d >= crystalPrice;
            friendsBuyButton.interactable    = d >= friendPrice;
            niceStuffBuyButton.interactable  = d >= nicestuffPrice;
            terraformMarsButton.interactable = d >= terraformPrice && niceStuffLevel >= niceStuffDescriptions.Length - 1;

            dustCounterText.text    = LongNum.FormatNumber(d);
            crystalCounterText.text = crystals.ToString();
            friendsCounterText.text = friends.ToString();

            //dustMoveText.text = "";
            if (d < crystalPrice)
            {
                crystalBuyText.text = string.Format("Buy a crystal, {0} more clicks.", crystalPrice - d);
            }
            else
            {
                crystalBuyText.text = "Buy a crystal!";
            }

            if (d < friendPrice)
            {
                friendsBuyText.text = string.Format("Buy a friend, {0} more clicks.", friendPrice - d);
            }
            else
            {
                friendsBuyText.text = "Buy a friend!";
            }

            if (d < terraformPrice)
            {
                terraformMarsText.text = string.Format("Mars will be terraformed in {0} clicks!", LongNum.FormatNumber((long)terraformPrice - d));
            }
            else
            {
                terraformMarsText.text = "Terraform Mars!";
            }
            //leaveMarsText.text = "";

            if (niceStuffLevel < niceStuffDescriptions.Length - 1)
            {
                niceStuffBuyText.text = string.Format("Buy {0}", niceStuffDescriptions[niceStuffLevel]) + (niceStuffBuyButton.interactable ? "!" : string.Format(", {0} more clicks!", nicestuffPrice - d));
            }
        }
예제 #6
0
        protected override long GetCalculationResult()
        {
            var sumOfDigits = LongNum.Fact(100).SumOfDigits;

            return(sumOfDigits);
        }