Example #1
0
        //static void populateBoard()
        //{
        //    for (int i = 0; i < 15; i++)
        //    {
        //        for (int j = 0; j < 15; j++)
        //        {
        //            BoardSpaces[i, j] = new BoardSpace();
        //        }
        //    }

        //    //test implementation which puts [t][e][s][t] in the top left of the board game and scores with easy to follow values
        //    //passed each type of modifier to verify scoring works
        //    BoardSpaces[0, 4] = new BoardSpace(new Tile('T', false), "3L", false, 0, 4);//T  of Test

        //    BoardSpaces[1, 0] = new BoardSpace(new Tile('A', false), "2W", false, 1, 0);
        //    BoardSpaces[1, 1] = new BoardSpace(new Tile('P', false), "3W", false, 1, 1);
        //    BoardSpaces[1, 2] = new BoardSpace(new Tile('P', false), "2L", false, 1, 2);
        //    BoardSpaces[1, 3] = new BoardSpace(new Tile('L', false), "3L", false, 1, 3);
        //    BoardSpaces[1, 4] = new BoardSpace(new Tile('E', false), "3L", false, 1, 4);//E of Test (already played)

        //    BoardSpaces[2, 4] = new BoardSpace(new Tile('S', false), "3L", false, 2, 4);//S of Test and So
        //    BoardSpaces[2, 5] = new BoardSpace(new Tile('O', false), "3L", false, 2, 5);//O of So

        //    BoardSpaces[3, 4] = new BoardSpace(new Tile('T', false), "3L", false, 3, 4);//T of Test
        //    BoardSpaces[3, 5] = new BoardSpace(new Tile('R', false), "3L", false, 3, 5);
        //    BoardSpaces[3, 6] = new BoardSpace(new Tile('A', false), "3L", false, 3, 6);
        //    BoardSpaces[3, 7] = new BoardSpace(new Tile('P', false), "3L", false, 3, 7);

        //}


        //checkListForMatch - pass a space and check a list of spaces for that passed space, even if the list is null
        //parameters -
        //space: current space the algorithm is looking at
        //spaceList: list to search in (usually list of BoardSpaces whose totals have been accounted for already)
        //returns - t/f depending on if the item was found
        static bool checkListForMatch(BoardSpace space, List <BoardSpace> spaceList)
        {
            if (spaceList != null)
            {
                return(spaceList.Contains(space));
            }

            return(false);
        }
Example #2
0
        // Start is called before the first frame update
        public static void Start()
        {
            for (int x = 0; x < 15; x++)
            {
                for (int y = 0; y < 15; y++)
                {
                    //triple words
                    if (x == 0 && y == 0)
                    {
                        boardSpaces[x, y] = new BoardSpace(null, "3W", true, x, y);
                    }
                    else if (x == 0 && y == 7)
                    {
                        boardSpaces[x, y] = new BoardSpace(null, "3W", true, x, y);
                    }
                    else if (x == 0 && y == 14)
                    {
                        boardSpaces[x, y] = new BoardSpace(null, "3W", true, x, y);
                    }
                    else if (x == 7 && y == 0)
                    {
                        boardSpaces[x, y] = new BoardSpace(null, "3W", true, x, y);
                    }
                    else if (x == 7 && y == 14)
                    {
                        boardSpaces[x, y] = new BoardSpace(null, "3W", true, x, y);
                    }
                    else if (x == 14 && y == 0)
                    {
                        boardSpaces[x, y] = new BoardSpace(null, "3W", true, x, y);
                    }
                    else if (x == 14 && y == 7)
                    {
                        boardSpaces[x, y] = new BoardSpace(null, "3W", true, x, y);
                    }
                    else if (x == 14 && y == 14)
                    {
                        boardSpaces[x, y] = new BoardSpace(null, "3W", true, x, y);
                    }
                    else if (x == 7 && y == 7)
                    {
                        boardSpaces[x, y] = new BoardSpace(null, "", true, x, y);
                    }

                    //double letters
                    else if (x == 0 && y == 3)
                    {
                        boardSpaces[x, y] = new BoardSpace(null, "2L", true, x, y);
                    }
                    else if (x == 0 && y == 11)
                    {
                        boardSpaces[x, y] = new BoardSpace(null, "2L", true, x, y);
                    }

                    else if (x == 2 && y == 6)
                    {
                        boardSpaces[x, y] = new BoardSpace(null, "2L", true, x, y);
                    }
                    else if (x == 2 && y == 8)
                    {
                        boardSpaces[x, y] = new BoardSpace(null, "2L", true, x, y);
                    }

                    else if (x == 3 && y == 0)
                    {
                        boardSpaces[x, y] = new BoardSpace(null, "2L", true, x, y);
                    }
                    else if (x == 3 && y == 7)
                    {
                        boardSpaces[x, y] = new BoardSpace(null, "2L", true, x, y);
                    }
                    else if (x == 3 && y == 14)
                    {
                        boardSpaces[x, y] = new BoardSpace(null, "2L", true, x, y);
                    }

                    else if (x == 6 && y == 2)
                    {
                        boardSpaces[x, y] = new BoardSpace(null, "2L", true, x, y);
                    }
                    else if (x == 6 && y == 6)
                    {
                        boardSpaces[x, y] = new BoardSpace(null, "2L", true, x, y);
                    }
                    else if (x == 6 && y == 8)
                    {
                        boardSpaces[x, y] = new BoardSpace(null, "2L", true, x, y);
                    }
                    else if (x == 6 && y == 12)
                    {
                        boardSpaces[x, y] = new BoardSpace(null, "2L", true, x, y);
                    }

                    else if (x == 7 && y == 3)
                    {
                        boardSpaces[x, y] = new BoardSpace(null, "2L", true, x, y);
                    }
                    else if (x == 7 && y == 11)
                    {
                        boardSpaces[x, y] = new BoardSpace(null, "2L", true, x, y);
                    }

                    else if (x == 8 && y == 2)
                    {
                        boardSpaces[x, y] = new BoardSpace(null, "2L", true, x, y);
                    }
                    else if (x == 8 && y == 6)
                    {
                        boardSpaces[x, y] = new BoardSpace(null, "2L", true, x, y);
                    }
                    else if (x == 8 && y == 8)
                    {
                        boardSpaces[x, y] = new BoardSpace(null, "2L", true, x, y);
                    }
                    else if (x == 8 && y == 12)
                    {
                        boardSpaces[x, y] = new BoardSpace(null, "2L", true, x, y);
                    }

                    else if (x == 11 && y == 0)
                    {
                        boardSpaces[x, y] = new BoardSpace(null, "2L", true, x, y);
                    }
                    else if (x == 11 && y == 7)
                    {
                        boardSpaces[x, y] = new BoardSpace(null, "2L", true, x, y);
                    }
                    else if (x == 11 && y == 14)
                    {
                        boardSpaces[x, y] = new BoardSpace(null, "2L", true, x, y);
                    }

                    else if (x == 12 && y == 6)
                    {
                        boardSpaces[x, y] = new BoardSpace(null, "2L", true, x, y);
                    }
                    else if (x == 12 && y == 8)
                    {
                        boardSpaces[x, y] = new BoardSpace(null, "2L", true, x, y);
                    }

                    else if (x == 14 && y == 3)
                    {
                        boardSpaces[x, y] = new BoardSpace(null, "2L", true, x, y);
                    }
                    else if (x == 14 && y == 11)
                    {
                        boardSpaces[x, y] = new BoardSpace(null, "2L", true, x, y);
                    }

                    //double words
                    else if (x == 1 && y == 1)
                    {
                        boardSpaces[x, y] = new BoardSpace(null, "2W", true, x, y);
                    }
                    else if (x == 2 && y == 2)
                    {
                        boardSpaces[x, y] = new BoardSpace(null, "2W", true, x, y);
                    }
                    else if (x == 3 && y == 3)
                    {
                        boardSpaces[x, y] = new BoardSpace(null, "2W", true, x, y);
                    }
                    else if (x == 4 && y == 4)
                    {
                        boardSpaces[x, y] = new BoardSpace(null, "2W", true, x, y);
                    }

                    else if (x == 1 && y == 13)
                    {
                        boardSpaces[x, y] = new BoardSpace(null, "2W", true, x, y);
                    }
                    else if (x == 2 && y == 12)
                    {
                        boardSpaces[x, y] = new BoardSpace(null, "2W", true, x, y);
                    }
                    else if (x == 3 && y == 11)
                    {
                        boardSpaces[x, y] = new BoardSpace(null, "2W", true, x, y);
                    }
                    else if (x == 4 && y == 10)
                    {
                        boardSpaces[x, y] = new BoardSpace(null, "2W", true, x, y);
                    }

                    else if (x == 13 && y == 1)
                    {
                        boardSpaces[x, y] = new BoardSpace(null, "2W", true, x, y);
                    }
                    else if (x == 12 && y == 2)
                    {
                        boardSpaces[x, y] = new BoardSpace(null, "2W", true, x, y);
                    }
                    else if (x == 11 && y == 3)
                    {
                        boardSpaces[x, y] = new BoardSpace(null, "2W", true, x, y);
                    }
                    else if (x == 10 && y == 4)
                    {
                        boardSpaces[x, y] = new BoardSpace(null, "2W", true, x, y);
                    }

                    else if (x == 13 && y == 13)
                    {
                        boardSpaces[x, y] = new BoardSpace(null, "2W", true, x, y);
                    }
                    else if (x == 12 && y == 12)
                    {
                        boardSpaces[x, y] = new BoardSpace(null, "2W", true, x, y);
                    }
                    else if (x == 11 && y == 11)
                    {
                        boardSpaces[x, y] = new BoardSpace(null, "2W", true, x, y);
                    }
                    else if (x == 10 && y == 10)
                    {
                        boardSpaces[x, y] = new BoardSpace(null, "2W", true, x, y);
                    }

                    //triple letters
                    else if (x == 5 && y == 1)
                    {
                        boardSpaces[x, y] = new BoardSpace(null, "3L", true, x, y);
                    }
                    else if (x == 1 && y == 5)
                    {
                        boardSpaces[x, y] = new BoardSpace(null, "3L", true, x, y);
                    }
                    else if (x == 5 && y == 5)
                    {
                        boardSpaces[x, y] = new BoardSpace(null, "3L", true, x, y);
                    }

                    else if (x == 9 && y == 1)
                    {
                        boardSpaces[x, y] = new BoardSpace(null, "3L", true, x, y);
                    }
                    else if (x == 13 && y == 5)
                    {
                        boardSpaces[x, y] = new BoardSpace(null, "3L", true, x, y);
                    }
                    else if (x == 9 && y == 5)
                    {
                        boardSpaces[x, y] = new BoardSpace(null, "3L", true, x, y);
                    }


                    else if (x == 5 && y == 13)
                    {
                        boardSpaces[x, y] = new BoardSpace(null, "3L", true, x, y);
                    }
                    else if (x == 1 && y == 9)
                    {
                        boardSpaces[x, y] = new BoardSpace(null, "3L", true, x, y);
                    }
                    else if (x == 5 && y == 9)
                    {
                        boardSpaces[x, y] = new BoardSpace(null, "3L", true, x, y);
                    }

                    else if (x == 9 && y == 13)
                    {
                        boardSpaces[x, y] = new BoardSpace(null, "3L", true, x, y);
                    }
                    else if (x == 13 && y == 9)
                    {
                        boardSpaces[x, y] = new BoardSpace(null, "3L", true, x, y);
                    }
                    else if (x == 9 && y == 9)
                    {
                        boardSpaces[x, y] = new BoardSpace(null, "3L", true, x, y);
                    }

                    //empty
                    else
                    {
                        boardSpaces[x, y] = new BoardSpace(null, "", true, x, y);
                    }
                }
            }
        }