Example #1
0
 //Recalling letters associated with Recall button
 //Also called when letters are wrongly placed
 public static void recall()
 {
     Debug.Log("recall");
     for (int i = 0; i < Chance.list.Count; i++)
     {
         obj = Chance.list[i];
         obj.SetActive(true);
         Vector2 ind = Chance.getIndex(obj);
         //Debug.Log(ind.x);
         //Debug.Log (ind.y);
         Board.matrix[(int)ind.x, (int)ind.y]  = 0;
         Board.unicode[(int)ind.x, (int)ind.y] = "0";
         if (obj.tag == "mixed")
         {
             Destroy(obj);
         }
         else
         {
             obj.transform.position             = obj.GetComponent <place>().initialpos;
             obj.GetComponent <place>().onboard = false;
             obj.GetComponent <place>().ontop   = false;
         }
     }
     Chance.list.Clear();
 }
Example #2
0
    void SetShapeNoiseSettings(PRNG prng, bool randomizeValues)
    {
        const string suffix = "_shape";

        if (randomizeValues)
        {
            var chance = new Chance(prng);
            SimpleNoiseSettings randomizedShapeNoise = new SimpleNoiseSettings()
            {
                numLayers = 4, lacunarity = 2, persistence = 0.5f
            };

            if (chance.Percent(80))                // Minor deformation
            {
                randomizedShapeNoise.elevation = Mathf.Lerp(0.2f, 3, prng.ValueBiasLower(0.3f));
                randomizedShapeNoise.scale     = prng.Range(1.5f, 2.5f);
            }
            else if (chance.Percent(20))                  // Major deformation
            {
                randomizedShapeNoise.elevation = Mathf.Lerp(3, 8, prng.ValueBiasLower(0.4f));
                randomizedShapeNoise.scale     = prng.Range(0.3f, 1);
            }

            // Assign settings
            randomizedShapeNoise.SetComputeValues(heightMapCompute, prng, suffix);
        }
        else
        {
            shapeNoise.SetComputeValues(heightMapCompute, prng, suffix);
        }
    }
        private void ModifyShaft(Shaft shaft)
        {
            var randomElevatorHeight   = Chance.Range(0, shaft.Height - 6);
            var randomElevatorPosition = shaft.BottomLeftCorner + (Directions.Up * randomElevatorHeight);

            shaft.AddFeature(randomElevatorPosition, FeatureTypes.Elevator);
        }
Example #4
0
        public void chance_of_not_0dot1_should_equal_chance_of_0dot9()
        {
            var chanceOf0Dot1 = new Chance(0.1);
            var chanceOf0Dot9 = new Chance(0.9);

            chanceOf0Dot1.Not().ShouldEqual(chanceOf0Dot9);
        }
Example #5
0
        public async Task DataTest(DbClient client)
        {
            await client.DropTableIfExists("books");

            Query query = client.GetQueryProvider().CreateTable <Book>();

            await client.ExecuteNonQuery(query);

            Chance chance = new Chance();

            List <Book> books = chance.N(20, () => chance.Object <Book>());

            List <NonQueryResult> res = await client.InsertAll(books);

            Assert.AreEqual(20, res.Count);

            List <Book> dbBooks = await client.Select <Book>();

            Assert.AreEqual(20, dbBooks.Count);

            foreach (Book book in books)
            {
                Book dbBook = dbBooks.First(b => book.ID == b.ID);

                Assert.AreEqual(book.Title, dbBook.Title);
                Assert.AreEqual(book.Year, dbBook.Year);
                Assert.AreEqual(book.Release, dbBook.Release);
            }
        }
Example #6
0
        public void chance_of_0dot1_should_equal_chance_of_0dot2()
        {
            var chanceOf0Dot1 = new Chance(0.1);
            var chanceOf0Dot2 = new Chance(0.2);

            chanceOf0Dot1.ShouldNotEqual(chanceOf0Dot2);
        }
Example #7
0
        public void chance_of_0dot1_should_not_equal_any_object()
        {
            var chanceOf0Dot1 = new Chance(0.1);
            var anyObject = new object();

            chanceOf0Dot1.ShouldNotEqual(anyObject);
        }
Example #8
0
        public void chance_of_0dot1_should_equal_chance_of_0dot1()
        {
            var chanceOf0Dot1 = new Chance(0.1);
            var anotherChanceOf0Dot1 = new Chance(0.1);

            chanceOf0Dot1.ShouldEqual(anotherChanceOf0Dot1);
        }
Example #9
0
        public void chance_of_0dot1_or_chance_of_0dot1_should_equal_chance_of_0dot19()
        {
            var chanceOf0Dot1 = new Chance(0.1);
            var chanceOf0Dot19 = new Chance(0.19);

            chanceOf0Dot1.Or(chanceOf0Dot1).ShouldEqual(chanceOf0Dot19);
        }
Example #10
0
        public void chance_of_0dot1_and_chance_of_0dot1_should_equal_chance_of_0dot01()
        {
            var chanceOf0Dot1 = new Chance(0.1);
            var chanceOf0Dot01 = new Chance(0.01);

            chanceOf0Dot1.And(chanceOf0Dot1).ShouldEqual(chanceOf0Dot01);
        }
Example #11
0
        public override IntVector2 GetRandomPosition()
        {
            var randomX = Chance.Range(Centerpoint.X - Radius, Centerpoint.X + Radius);
            var randomY = Chance.Range(Centerpoint.Y, Centerpoint.Y + Radius - DistanceFromCenterpoint(randomX));

            return(new IntVector2(randomX, randomY));
        }
Example #12
0
 public ItemServiceTests()
 {
     _chance             = new Chance();
     _commandDispatcher  = Substitute.For <ICommandDispatcher>();
     _itemCommandFactory = Substitute.For <IItemCommandFactory>();
     _itemService        = new ItemService(_commandDispatcher, _itemCommandFactory);
 }
Example #13
0
        public string NextSentence()
        {
            var result     = new StringBuilder();
            var wordLength = Chance.Between(8, 12);

            for (int i = 0; i < wordLength; i++)
            {
                var syllableLength = Chance.Between(2, 4);
                for (int j = 0; j < syllableLength; j++)
                {
                    result.Append(this.SyllableGenerator.NextSyllable());
                }

                if (Chance.Roll(0.05) && i < wordLength - 1)
                {
                    result.Append(",");
                }

                if (Chance.Roll(0.20))
                {
                    result.Append(" " + this.Conjunction);
                }

                result.Append(" ");
            }

            return(result[0].ToString().ToUpper() + result.ToString().Substring(1).Trim() + ".");
        }
    public void TriggerNextQuestion()
    {
        if (activeCard != null)
        {
            Destroy(activeCard);
        }
        if (questionStack.Count == 0 && chanceStack.Count == 0)
        {
            Debug.Log("No more questions!");
            ui.Show(false);
            return;
        }
        if (Random.value < 0.5)
        {
            currentQuestion = questionStack.Dequeue();
            activeCard      = CreateCard(currentQuestion, ViewVector);
            ui.ShowQuestion(currentQuestion);
        }
        else
        {
            currentChance = chanceStack.Dequeue();
            activeCard    = CreateChanceCard(currentChance, ViewVector);
            ui.ShowChance(currentChance);

            StartCoroutine(ActivateChanceCard(activeCard, 2f));
        }
    }
Example #15
0
        private async Task SeedCategoryAsync(IStoreContext context, int inserts)
        {
            Chance chance          = new Chance();
            int    categoriesCount = context.Categories.Count();

            while (categoriesCount < inserts)
            {
                for (int i = categoriesCount; i < inserts; i++)
                {
                    var category = new Category
                    {
                        Name           = chance.Word(0, 0, true),
                        Description    = chance.Paragraph(3),
                        RootCategoryID = chance.Bool() && i > 0 ? chance.Integer(1, i) : default(int?)
                    };

                    await context.Categories.AddAsync(category);

                    await context.SaveChangesAsync();

                    chance = chance.New();
                }

                categoriesCount = context.Categories.Count();
            }
        }
Example #16
0
        public override Hazard Build(Chunk containingChunk, Space containingSpace)
        {
            // If we cannot guarantee this is a safe place to build, don't
            if (!containingChunk.Contains(_anchorPosition) ||
                containingChunk.GetBlockForPosition(_anchorPosition) == null)
            {
                return(null);
            }

            while (_maxSegments <= MAX_STALAG_SEGMENTS)
            {
                var nextSegmentLocation = Position + (_facingDirection * _maxSegments);
                if (!containingSpace.Contains(nextSegmentLocation) ||
                    !containingChunk.Contains(nextSegmentLocation) ||
                    containingSpace.GetBlockType(nextSegmentLocation) != Blocks.BlockTypes.None)
                {
                    break;
                }
                else
                {
                    _maxSegments++;
                }
            }

            var stalag = HazardLoader.CreateHazard(HazardTypes.Stalag, Position) as StalagHazard;

            stalag.Initialize(_facingDirection, Chance.Range(1, _maxSegments));
            return(stalag);
        }
Example #17
0
        public JsonResult GenerateCode()
        {
            string Key = "";

            if (OAuthWebSecurity.IsAuthenticatedWithOAuth)
            {
                Chance chance = new Chance();
                bool   state  = false;
                while (state == false)//keep on checking until a unique key found
                {
                    Key    = RandomString(15);
                    chance = _db.Chance.FirstOrDefault(c => c.Code == Key);
                    if (chance == null)
                    {
                        _db.User.FirstOrDefault(c => c.UserId == WebSecurity.CurrentUserId).Chance.Add(new Chance {
                            Code = Key, DateCreated = DateTime.Now,
                        });;

                        _db.SaveChanges();



                        state = true;
                    }
                }
            }



            return(Json(Key, JsonRequestBehavior.AllowGet));
        }
Example #18
0
        private List <EnemySpawn> GenerateContainedEnemies()
        {
            var containedEnemies = new List <EnemySpawn>();

            if (_allowEnemies)
            {
                var riskPoints = EnemyPicker.DetermineRiskPoints(_chunkBuilder.Depth, _chunkBuilder.Remoteness);
                riskPoints += _extraRiskPoints;

                var enemies = EnemyPicker.RequestEnemies(riskPoints, new EnemyRequestCriteria()
                {
                    HeightsAllowed = new Range(0, _height),
                    LengthsAllowed = new Range(0, _length)
                });

                foreach (var enemy in enemies)
                {
                    var xPos     = Chance.Range(_leftEnd.X, _rightEnd.X);
                    var position = new IntVector2(xPos, _leftEnd.Y);

                    containedEnemies.Add(new EnemySpawn(position, enemy));
                }
            }

            return(containedEnemies);
        }
Example #19
0
        public override IntVector2 GetRandomPoint()
        {
            var randomX = Chance.Range(_centerpoint.X - _radius, _centerpoint.X + _radius + 1);
            var randomY = Chance.Range(_centerpoint.Y, _centerpoint.Y + (_radius - DistanceFromCenterpoint(randomX)));

            return(new IntVector2(randomX, randomY));
        }
Example #20
0
    //  Called from animation
    IEnumerator Hop()
    {
        //  Audio
        if (Chance.Check(.5f))
        {
            audioSource.pitch = Random.Range(.7f, 1f);
            audioSource.PlayOneShot(ChirpSound, .5f);
        }
        audioSource.pitch = Random.Range(.7f, 1.3f);
        audioSource.PlayOneShot(JumpSound, .40f);

        while (animator.GetBool(isHoppingHash))
        {
            transform.Translate(transform.forward * GetFarthestHop() * Time.deltaTime, Space.World);
            if (checkGoal)
            {
                CheckForGoal();
            }
            yield return(null);
        }
        if (checkGoal)
        {
            checkGoal = false;
        }
    }
Example #21
0
        public ChunkBuilder AddBlocks(params BlockTypes[] blocksToAdd)
        {
            // Randomly order the blocks (without actually changing their order,
            // because that would be unnecessarily expensive and may change other
            // effects.
            var selectionOrder = Chance.ExclusiveRandomOrder(_blockBuilders.Count);

            var addedBlocks = 0;

            for (var blockIndex = 0; blockIndex < _blockBuilders.Count; blockIndex++)
            {
                // Foreach block, if it the randomized order shows it as one of the
                // first blocks, assign it to the blockType specified in the matching
                // index of blocks to add.
                if (selectionOrder[blockIndex] < blocksToAdd.Length)
                {
                    _blockBuilders[blockIndex].SetType(blocksToAdd[selectionOrder[blockIndex]]);
                    addedBlocks++;

                    // If we have added all blocks, break.
                    if (addedBlocks >= blocksToAdd.Length)
                    {
                        break;
                    }
                }
            }

            OnChunkBuilderChanged.Raise(this);

            return(this);
        }
Example #22
0
        public void Constructor()
        {
            var value  = 12.345f;
            var chance = new Chance(value);

            Assert.AreEqual(value, (float)chance);
        }
Example #23
0
        public void ChanceShouldReturnSumOfAllNumbers(List <int> rolledDice, int expectedOutcome)
        {
            var chance = new Chance();
            var result = chance.CalculateScore(rolledDice);

            Assert.Equal(expectedOutcome, result);
        }
Example #24
0
        public void RefreshChance(Chance value)
        {
            if (value.cash_belongsTo == 2)
            {
                _txtTitle.text = value.cash_title;
                _txtNnum.text  = "1";
                if (null != _imgPic)
                {
                    WebManager.Instance.LoadWebItem(value.cash_cardPath, item => {
                        using (item)
                        {
                            _imgPic.sprite = item.sprite;
                        }
                    });
                }
            }
            else
            {
                _txtTitle.text = value.title;
                _txtNnum.text  = "1";
                if (null != _imgPic)
                {
                    WebManager.Instance.LoadWebItem(value.cardPath, item => {
                        using (item)
                        {
                            _imgPic.sprite = item.sprite;
                        }
                    });
                }
            }

            chance = value;
        }
Example #25
0
        private List <EnemySpawn> GenerateContainedEnemies()
        {
            var containedEnemies = new List <EnemySpawn>();

            if (_allowEnemies)
            {
                var riskPoints = EnemyPicker.DetermineRiskPoints(_chunkBuilder.Depth, _chunkBuilder.Remoteness);
                riskPoints  = Mathf.Max(riskPoints, 10);
                riskPoints += _extraRiskPoints;

                var enemies = EnemyPicker.RequestEnemies(riskPoints, new EnemyRequestCriteria()
                {
                    HeightsAllowed = new Range(0, _radius / 2),
                    LengthsAllowed = new Range(0, _radius / 2)
                });

                foreach (var enemy in enemies)
                {
                    var requirementsForEnemy = EnemyPicker.GetRequirementsForEnemy(enemy);

                    var requiredOffset = requirementsForEnemy.Height;

                    var xPosition = Chance.Range(-_radius + requiredOffset, _radius - requiredOffset) + _centerpoint.X;

                    var position = new IntVector2(xPosition, _centerpoint.Y);

                    containedEnemies.Add(new EnemySpawn(position, enemy));
                }
            }

            return(containedEnemies);
        }
Example #26
0
        static void Main(string[] args)
        {
            int number = 0;

            while (number < max)
            {
                Random random = new Random();
                string seed   = RandomString(20);
                //Chance c = new Chance(seed);
                Chance c       = new Chance();
                var    enumVal = (AgeRanges)adultAgeRange;
                try
                {
                    Console.WriteLine(c.Birthday(enumVal));
                }
                catch (Exception e)
                {
                    Console.WriteLine($"Attempt failed after {number} tries");
                    Console.WriteLine(e.Message);
                }

                number++;
            }

            Console.WriteLine($"Completed run of {max} dates");
            Console.ReadLine();
        }
Example #27
0
 public Currency(Blacksmith_whetstone blacksmith_whetstone, Armourer_scrap armourer_scrap, Glassblower_bauble glassblower_bauble, Gemcutter_prism gemcutter_prism, Cartographer_chisel cartographer_chisel, Transmutation transmutation, Alteration alteration, Annulment annulment, Chance chance, Augment augment, Exalted exalted, Mirror mirror, Regal regal, Alchemy alchemy, Chaos chaos, Blessed blessed, Divine divine, Jeweller jeweller, Fusing fusing, Chromatic chromatic, Scouring scouring, Regret regret, Vaal vaal, Silver_coin silver_coin, Perandus_coin perandus_coin, Apprentice_sextant apprentice_sextant, Journeyman_sextant journeyman_sextant, Master_sextant master_sextant)
 {
     this.blacksmith_whetstone = blacksmith_whetstone;
     this.armourer_scrap       = armourer_scrap;
     this.glassblower_bauble   = glassblower_bauble;
     this.gemcutter_prism      = gemcutter_prism;
     this.cartographer_chisel  = cartographer_chisel;
     this.transmutation        = transmutation;
     this.alteration           = alteration;
     this.annulment            = annulment;
     this.chance             = chance;
     this.augment            = augment;
     this.exalted            = exalted;
     this.mirror             = mirror;
     this.regal              = regal;
     this.alchemy            = alchemy;
     this.chaos              = chaos;
     this.blessed            = blessed;
     this.divine             = divine;
     this.jeweller           = jeweller;
     this.fusing             = fusing;
     this.chromatic          = chromatic;
     this.scouring           = scouring;
     this.regret             = regret;
     this.vaal               = vaal;
     this.silver_coin        = silver_coin;
     this.perandus_coin      = perandus_coin;
     this.apprentice_sextant = apprentice_sextant;
     this.journeyman_sextant = journeyman_sextant;
     this.master_sextant     = master_sextant;
 }
Example #28
0
        public void Border()
        {
            var isThrowed = false;

            try { _ = new Chance(12.345f); }
            catch { isThrowed = true; }
            Assert.IsFalse(isThrowed);
        }
Example #29
0
 public void setChance(int num)
 {
     if (num == 1) {
         currentChance = Chance.firstChance;
     } else if (num == 2) {
         currentChance = Chance.secondChance;
     }
 }
Example #30
0
        public void Should_Return_Sum_Of_All_Active_Sides_In_Roll(List <IDice> roll, int expectedOutput)
        {
            var chanceCategory = new Chance();

            var rollTotal = chanceCategory.GetScore(roll);

            Assert.Equal(expectedOutput, rollTotal);
        }
Example #31
0
        public void UpperBorder()
        {
            var isThrowed = false;

            try { _ = new Chance(123.456f); }
            catch { isThrowed = true; }
            Assert.IsTrue(isThrowed);
        }
Example #32
0
        public void LowerBorder()
        {
            var isThrowed = false;

            try { _ = new Chance(-0.123f); }
            catch { isThrowed = true; }
            Assert.IsTrue(isThrowed);
        }
Example #33
0
        private async Task SeedOrders(IStoreContext context)
        {
            Chance chance = new Chance();

            if (await context.Orders.CountAsync() > 0)
            {
                return;
            }

            var custumers = await context.Customers.ToListAsync();

            foreach (var customer in custumers)
            {
                if (chance.Bool())
                {
                    int productCount = chance.Integer(1, 4);
                    var date         = chance.Date(0, 0, 0, customer.RegistrationDate.Year + 1, 2019);
                    var confirmed    = chance.Bool();
                    var order        = new Order
                    {
                        RegistrationDate = date,
                        ConfirmationDate = confirmed ? date : default(DateTime?),
                        CancellationDate = !confirmed ? date : default(DateTime?),
                        OrderedProducts  = new List <OrderedProduct>()
                    };
                    for (int i = 0; i < productCount; i++)
                    {
                        var productMaxID = context.Products.Max(x => x.ProductID);
                        var productID    = chance.Integer(1, productMaxID);
                        var product      = await context.Products.SingleOrDefaultAsync(x => x.ProductID == productID);

                        while (product == null)
                        {
                            productID = chance.Integer(1, productMaxID);
                            product   = await context.Products.SingleOrDefaultAsync(x => x.ProductID == productID);
                        }

                        var orderedProduct = new OrderedProduct
                        {
                            Amount           = chance.Integer(1, 4),
                            Value            = product.Value,
                            ProductID        = product.ProductID,
                            RegistrationDate = date
                        };

                        order.OrderedProducts.Add(orderedProduct);
                    }
                    if (customer.Orders == null)
                    {
                        customer.Orders = new List <Order>();
                    }
                    customer.Orders.Add(order);
                }
                chance = chance.New();
            }

            await context.SaveChangesAsync();
        }
Example #34
0
    private int[] minimax(int depth, Chance chance, int alpha, int beta)
    {
        // Generate possible next moves in a List of int[2] of {row, col}.
        List <int> nextMoves = generateMoves();

        // compChance is maximizing; while userChance is minimizing
        //int score = (chance == Chance.COMP) ? int.MinValue : int.MaxValue;
        int score;
        int bestBox = -1;

        if (nextMoves.Count == 0 || depth == 0)
        {
            // Gameover or depth reached, evaluate score
            score = evaluate();
            return(new int[] { score, bestBox });
        }
        else
        {
            foreach (int move in nextMoves)
            {
                // Try this move for the current "player"
                if (chance == Chance.COMP)
                {
                    my_grid[move] = 2;
                }
                else
                {
                    my_grid[move] = 1;
                }

                if (chance == Chance.COMP)
                {  // myChance (computer) is maximizing player
                    score = minimax(depth - 1, Chance.USER, alpha, beta)[0];
                    if (score > alpha)
                    {
                        alpha   = score;
                        bestBox = move;
                    }
                }
                else
                {  // oppSeed is minimizing player
                    score = minimax(depth - 1, Chance.COMP, alpha, beta)[0];
                    if (score < beta)
                    {
                        beta    = score;
                        bestBox = move;
                    }
                }
                //UNDO MOVE
                my_grid[move] = 0;
                if (alpha >= beta)
                {
                    break;
                }
            }
        }
        return(new int[] { (chance == Chance.COMP) ? alpha : beta, bestBox });
    }
Example #35
0
        public MonsterDenBuilder(ChunkBuilder chunkBuilder)
            : base(chunkBuilder)
        {
            _centerpoint = new IntVector2(Chance.Range(_chunkBuilder.BottomLeftCorner.X, _chunkBuilder.TopRightCorner.X),
                                          Chance.Range(_chunkBuilder.BottomLeftCorner.Y, _chunkBuilder.TopRightCorner.Y));

            _radius = Chance.Range(8, 20);
            OnSpaceBuilderChanged.Raise(this);
        }
Example #36
0
        internal override object GetValue(Chance chance)
        {
            MethodInfo method = chance.GetType()
                                .GetTypeInfo()
                                .GetMethod("Object", new Type[] { })
                                .MakeGenericMethod(objectType);

            return(method.Invoke(chance, null));
        }
Example #37
0
        public async Task <ActionResult> DeleteConfirmed(int id)
        {
            Chance chance = await db.chances.FindAsync(id);

            db.chances.Remove(chance);
            await db.SaveChangesAsync();

            return(RedirectToAction("Index"));
        }
Example #38
0
 public void setChance(Chance chance)
 {
     current_chance = chance;
 }
Example #39
0
 // Use this for initialization
 void Start()
 {
     speed = initialSpeed;
     littleChance = new Chance(0.7f * Game.difficulty,2f);
     bigChance = new Chance(0.50f * Game.difficulty, 15f);
     // This means grab will fire at most once a second
     // So if you do escape you aren't instantly f****d.
     grabChance = new Chance(0.8f,1f);
     bm = new BezierMover(gameObject);
     bm.speed = speed;
 }
Example #40
0
    private int[] minimax(int depth, Chance chance, int alpha, int beta)
    {
        // Generate possible next moves in a List of int[2] of {row, col}.
        List<int> nextMoves = generateMoves();

        // compChance is maximizing; while userChance is minimizing
        //int score = (chance == Chance.COMP) ? int.MinValue : int.MaxValue;
        int score;
        int bestBox = -1;

        if (nextMoves.Count == 0 || depth == 0)
        {
            // Gameover or depth reached, evaluate score
            score = evaluate();
            return new int[] { score, bestBox };
        }
        else
        {
            foreach (int move in nextMoves)
            {
                // Try this move for the current "player"
                if (chance == Chance.COMP)
                    my_grid[move] = 2;
                else
                    my_grid[move] = 1;

                if (chance == Chance.COMP)
                {  // myChance (computer) is maximizing player
                    score = minimax(depth - 1, Chance.USER, alpha, beta)[0];
                    if (score > alpha)
                    {
                        alpha = score;
                        bestBox = move;
                    }
                }
                else
                {  // oppSeed is minimizing player
                    score = minimax(depth - 1, Chance.COMP, alpha, beta)[0];
                    if (score < beta)
                    {
                        beta = score;
                        bestBox = move;
                    }
                }
                //UNDO MOVE
                my_grid[move] = 0;
                if (alpha >= beta) break;

            }

        }
        return new int[] { (chance == Chance.COMP) ? alpha : beta, bestBox };
    }
Example #41
0
 public Player(string name)
 {
     currentChance = Chance.firstChance;
     this.name = name;
 }
Example #42
0
 public static void ShouldEqual(this Chance chance, Chance other)
 {
     Assert.AreEqual(chance,other);
 }
Example #43
0
 private bool hasWon(Chance chance)
 {
     int num = 1;
     if(chance == Chance.COMP)
     {
         num = 2;
     }
     if ((my_grid[0] == num && my_grid[1] == num && my_grid[2] == num) || (my_grid[3] == num && my_grid[4] == num && my_grid[5] == num)
         || (my_grid[6] == num && my_grid[7] == num && my_grid[8] == num) || (my_grid[0] == num && my_grid[3] == num && my_grid[6] == num)
         || (my_grid[1] == num && my_grid[4] == num && my_grid[7] == num) || (my_grid[2] == num && my_grid[5] == num && my_grid[8] == num)
         || (my_grid[0] == num && my_grid[4] == num && my_grid[8] == num) || (my_grid[2] == num && my_grid[4] == num && my_grid[6] == num))
         return true;
     else
         return false;
 }