예제 #1
0
        private int ScoreCombo(CustomBasicList <int> mainCol, CustomBasicList <int> comboList, out bool receiveMults)
        {
            int sums   = mainCol.Where(items => comboList.Contains(items)).Sum();
            int counts = mainCol.Where(items => comboList.Contains(items)).Count();

            if (counts == 6)
            {
                receiveMults = true;
            }
            else
            {
                receiveMults = false;
            }
            return(sums);
        }
예제 #2
0
        private void CreateSquares()
        {
            CustomBasicList <int> arr_Mines = new CustomBasicList <int>();
            int int_Square;
            int int_SquareCount = 1;

            _arr_Squares = new CustomBasicList <MineSquareCP>();
            while (arr_Mines.Count < NumberOfMines)
            {
                int_Square = GetRandomInteger((NumberOfRows * NumberOfColumns));
                if ((!(arr_Mines.Contains(int_Square))) & (int_Square > 0))
                {
                    arr_Mines.Add(int_Square);
                }
            }

            var loopTo = NumberOfRows;

            for (int int_Row = 1; int_Row <= loopTo; int_Row++)
            {
                var loopTo1 = NumberOfColumns;
                for (int int_Col = 1; int_Col <= loopTo1; int_Col++)
                {
                    var obj_TempSquare = new MineSquareCP(int_Col, int_Row);

                    if ((arr_Mines.Contains(int_SquareCount)))
                    {
                        obj_TempSquare.IsMine = true;
                    }

                    _arr_Squares.Add(obj_TempSquare);

                    int_SquareCount += 1;
                }
            }

            // *** Get numbers for each of the non-mine squares
            foreach (var obj_TempSquare in _arr_Squares)
            {
                obj_TempSquare.NeighborMines = CountNeighborMines(obj_TempSquare);
            }


            // needs a subscription
            // because from this point, the ui needs to do the ui portions.
            //Aggregator.Publish(new SubscribeGameBoardEventModel());
        }