Search Unity

2D string array to 2 string array

Discussion in 'Scripting' started by freedom667, Mar 22, 2018.

  1. freedom667

    freedom667

    Joined:
    Sep 6, 2015
    Posts:
    425
    I declared 2d array as column (x) and row(y). I want to write to another 2 array. I can write strings in row but I could not write column. my code is here. I made it so complicated. somebody know how can we do it?

    Code (CSharp):
    1. [System.Serializable]
    2. public class ColumnLetters
    3. {
    4.     public List<string> lettersRows = new List<string>(20);
    5. }
    6.  
    7.     public List<ColumnLetters> lettersColumns = new List<ColumnLetters>(10);
    8.  
    9.     public void WriteText()
    10.     {
    11.         for (int i = 0; i < lettersColumns.Count; i++)
    12.         {
    13.             rows[i] = "";
    14.             foreach (string item in lettersColumns[i].lettersRows)
    15.             {
    16.                 rows[i] += item;
    17.             }
    18.         }
    19.             // I could not to do here. So column section.
    20.             column[0] = "";
    21.             foreach (string item in rows)
    22.             {
    23.                 column[0] += item;
    24.  
    25.             }
    26.     }
     
  2. Brathnann

    Brathnann

    Joined:
    Aug 12, 2014
    Posts:
    7,187
    This isn't a 2D array, it's a list of columnLetters, which each contains a list.
    I'm actually a bit confused as to what you are doing as it looks like you're trying to write to two different arrays? (which also isn't a 2D array.

    Your title and description says one thing, but your code suggest another thing, so I'm not sure what you are trying to do.

    Code (CSharp):
    1. public void WriteText()
    2.     {
    3.         for (int i = 0; i < lettersColumns.Count; i++)
    4.         {
    5.             for (int x = 0; x < lettersColumns[i].letterRows;x++ )
    6.             {
    7.                 rows[x] += lettersColumns[i].letterRows[x]; //This takes each row in a given slot from each list and adds it on
    8.                 column[i] += lettersColumns[i].letterRows[x]; //This takes all words from a given letterRows list and adds them together.
    9.             }
    10.          }
    11.     }
    So if you have

    Dog Cat Mouse
    Turtle Horse Frog

    the rows would be
    DogTurtle
    CatHorse
    MouseFrog

    and column would be
    DogCatMouse
    TurtleHorseFrog

    Just not sure if that is what you are trying to do or not.
     
  3. freedom667

    freedom667

    Joined:
    Sep 6, 2015
    Posts:
    425
    this method won't work. because if spaces between blocks, then writing entire word.

    for example:

    C A T.

    there are spaces right? it's writing as CAT again. this should not be. So I have to check chars. my strings in string array converting to char array as 2D. because string array size 5. I wrote this code but did not work again.

    if "C","A",T" in column or row as sorted, then it will say "true".

    Code (CSharp):
    1. public void WriteText()
    2.     {
    3.         for (int i = 0; i < 10; i++)
    4.         {
    5.             for (int n = 0; n < 20; n++)
    6.             {
    7.                 if (columnsLetters[i, n] != null)
    8.                 {
    9.                     for (int k = 0; k < answerChars.Length; k++)
    10.                     {
    11.                         if (columnsLetters[i, n].Contains(answerChars[k].chars.ToString()) || columnsLetters[i, n].Contains(answerCharsStr[k].chars.ToString()))
    12.                         {
    13.                             Debug.Log("asd");
    14.                         }
    15.                     }
    16.                 }
    17.             }
    18.         }
    19.     }
    I'm really confused on this game. I'm making wordtris. there is an video about this named wordtris in youtube.
     
    Last edited: Mar 22, 2018
  4. Brathnann

    Brathnann

    Joined:
    Aug 12, 2014
    Posts:
    7,187
    I'll be honest, I'm still confused about what you are trying to do. I don't have the time right now to search for and watch a youtube video to try and figure it out. I'll try to help later if nobody else has a chance to help you out with this.
     
  5. freedom667

    freedom667

    Joined:
    Sep 6, 2015
    Posts:
    425
    a word game tetris style. if letter in the blocks matching any word then it giving point. that's it. I'll show you a picture about it.



    There are two words. "DOG" and "CAT" you see? one at bottom and one at middle. they will match if being this. sure the letters will match as up to down too.
     
  6. Brathnann

    Brathnann

    Joined:
    Aug 12, 2014
    Posts:
    7,187
    Ok, but I don't understand your code setup. How are you trying to determine you have a word match?

    If you loop through and generate a string, the bottom row would be
    Code (CSharp):
    1. A CATGRO R
    For example. If you don't have a piece at a certain slot, just insert a space. Then you could split at the spaces, toss out any parts that aren't at least x number of letters, and then check for matches in the remaining parts.

    So, just loop through each row, then loop through each column. My earlier code would probably work, but it was a quick type up, so I didn't test exact, but it should give you similar results. You probably don't want to use list though. I would use an array since you can let the value of each slot. An array for example could be [ ][A][D][ ]
    A list you could do the same, but if you remove something, the list adjust. But using a list serves no purpose here as you don't need something that can adjust.
     
  7. freedom667

    freedom667

    Joined:
    Sep 6, 2015
    Posts:
    425
    your code always writing. I added rows[x] ="" and column = "" but same problem again. Also I thought adding spacing but I failed completely. I have 2 days for this game. after this, matched letters will destroy. one more thing, I will add bomb. if bomb touch any block bomb and touched block will destroy.
     
  8. Brathnann

    Brathnann

    Joined:
    Aug 12, 2014
    Posts:
    7,187
    Not sure what you mean by code always writing. But you'll have to clear your values when you're done checking for matching words. (if that's what you mean)

    I'm not writing everything for you, I'm working with what you wrote and showing you some adjustments.

    It's good to have goals. Make sure you get each part working before adding on the next part. :)
     
  9. freedom667

    freedom667

    Joined:
    Sep 6, 2015
    Posts:
    425
    think update method. if i write your code to Update method, then it will write continous. for example: "UUU.....UUUU" like this. therefore row[x] = ""; and column = ""; should be there. but same problem again. working like Update method. adding spacing; I will try it.
     
  10. Brathnann

    Brathnann

    Joined:
    Aug 12, 2014
    Posts:
    7,187
    Why would you have that in update? You only need to check when a piece is put in place.
     
  11. freedom667

    freedom667

    Joined:
    Sep 6, 2015
    Posts:
    425
    I said "think like Update Method". I think I could not tell you clearly. e.g. there are 4 blocks. "A","B","C","D". and the added to array as "ABCD", when another letter block(E) came there, writing again "ABCDABCDE" now you got it? Also can we talk at PM? because I think our talks goes long
     
    Last edited: Mar 22, 2018
  12. Brathnann

    Brathnann

    Joined:
    Aug 12, 2014
    Posts:
    7,187
    Yes, and as I mentioned, you need to clear the values between checks. So if the player drops a block, you check the values, then clear. Next block, check values and clear. So honestly, you could also just handle it with a string that you build and that would work just as well.

    There are certainly better ways to do this.

    Prefer chatting on here, it doesn't hurt for the info to be here in case others can help or need similar help.
     
  13. freedom667

    freedom667

    Joined:
    Sep 6, 2015
    Posts:
    425
    OK. Do you know adding space? I wrote if else statement with contains but this code spacing all between characters
    Code (CSharp):
    1. for (int i = 0; i < 10; i++)
    2.         {
    3.             for (int x = 0; x < 20; x++)
    4.             {
    5.                 column[i] += lettersColumns[i].lettersRows[x]; //This takes all words from a given letterRows list and adds them together.
    6.                 rows[x] += lettersColumns[i].lettersRows[x]; //This takes each row in a given slot from each list and adds it on
    7.                 if (lettersColumns[i].lettersRows[x].Contains(""))
    8.                 {
    9.                     column[i] += " ";
    10.                     rows[x] += " ";
    11.                 }
    12.             }
    13.         }
    I wrote " " insted of "" or null but failed again.
     
    Last edited: Mar 22, 2018
  14. Brathnann

    Brathnann

    Joined:
    Aug 12, 2014
    Posts:
    7,187
    Code (CSharp):
    1. for (int i = 0; i < 10; i++)
    2.         {
    3.             for (int x = 0; x < 20; x++)
    4.             {
    5.                column[i] += lettersColumns[i].lettersRows[x]; //This takes all words from a given letterRows list and adds them together.
    6.                 rows[x] += lettersColumns[i].lettersRows[x]; //This takes each row in a given slot from each list and adds it on
    7.                 if (lettersColumns[i].lettersRows[x].Contains(" ")) //Modified to check if it contains a space
    8.                 {
    9.                     column[i] += " ";
    10.                     rows[x] += " ";
    11.                 }
    12.             }
    13.  
    14. " " //Checks for a space
    15. "" //No space here.
    16.         }
    Well, if you're checking .Contains to see if it is a space, you need to check for the space
     
  15. freedom667

    freedom667

    Joined:
    Sep 6, 2015
    Posts:
    425
    I wrote " " already I said that before but same problem again. Actually we have to check if its null, i did this too but did not work
     
  16. methos5k

    methos5k

    Joined:
    Aug 3, 2015
    Posts:
    8,712
    Since I think the main logic has already been explained in answers, I have a curiosity question:
    Is there a min length that words must be in order to be counted? :)
     
  17. freedom667

    freedom667

    Joined:
    Sep 6, 2015
    Posts:
    425
    Words? Or letters? İf you ask letters, min length will be 3. If you ask words, min length will be 5. So player will match the words 5
     
  18. sngdan

    sngdan

    Joined:
    Feb 7, 2014
    Posts:
    1,154
    i am not clear what you want, is it

    Input:
    ABC
    DEF
    GHI

    Output:
    1. ABC
    2. DEF
    3. GHI
    4. ADG
    5. BEH
    6. CFI

    so no diagonal (i.e AEI) and no reverse (I.e. CBA)
     
  19. freedom667

    freedom667

    Joined:
    Sep 6, 2015
    Posts:
    425
    I'm work with if any element is null in array, then give space.

    I tried
    Code (CSharp):
    1. if (lettersColumns[i].lettersRows[x].Contains(" ")) //Modified to check if it contains a space
    2.                 {
    3.                     column[i] += " ";
    4.                     rows[x] += " ";
    5.                 }
    or

    Code (CSharp):
    1. if (lettersColumns[i].lettersRows[x] == null) //Modified to check if it contains a space
    2.                 {
    3.                     column[i] += " ";
    4.                     rows[x] += " ";
    5.                 }
    but it did not giving true result. null function checking all elements I think.
     
  20. sngdan

    sngdan

    Joined:
    Feb 7, 2014
    Posts:
    1,154
    I am getting lost in translation. Maybe take a step back. What is the overall problem you want to solve? I assume that once a new block (character) is placed in a position, you want to check if it forms a valid word (from a list) with any adjacent characters?

    So, what are the rules for checking words? Horizontal, vertical, diagonal, reverse allowed or not

    What is the source data structure, I.e. How is the grid of blocks (each having one character) stored? I would think that this is an array, I.e. var grid = new char[rows, columns]

    Then you just walk from the position a new char is placed in the wanted directions until you hit space or the border and put all chars into a string. Then you walk backwards through the string and compare it to the solution words, each iteration cutting off the last character until you reach your min length of 3
     
  21. freedom667

    freedom667

    Joined:
    Sep 6, 2015
    Posts:
    425
    not diagonal and reverse, just horizontal and vertical, if blocks(character) valid word (from a list), then it will be score. I uploaded an image you can see it. just, the letters match up with a word or not, I have difficulty with it. the blocks have letter array and putting the letters as random. Actually, if can i do this, maybe after that will be easier.
     
  22. fire7side

    fire7side

    Joined:
    Oct 15, 2012
    Posts:
    1,819
    I think you want something like this:
    Code (csharp):
    1.  
    2. List<string> words = new List<string>();
    3. string word;
    4. for(int i = 0; i < rows.Length;i++){
    5. if(rows[i] == null){
    6. if(word != null){
    7. words.Add(word);
    8. word = null;
    9. }
    10. else word+= rows[i];
    11. }
    12. }
    13.  
    That would give a list of possible words to check.
     
  23. sngdan

    sngdan

    Joined:
    Feb 7, 2014
    Posts:
    1,154
    Well a little bit, I think it is as I described above, so if we stay at the simplified example considering one row

    Start: __AB_DE__ -> no word as min length is 3

    Move 1: __ABCDE__ -> C added as new letter

    Possible words to check
    1. ABCDE
    2. ABCD
    3. BCDE
    4. ABC
    5. BCD
    6. CDE

    So step 1 is to find the string that contains the last dropped character, which is bound by either a border or a space, you basically walk from the position to the left until you hit a border or space/null and memorize this as the start index and from there you go right and add each character until you hit the border or first space/null

    Step 2 is to split this string up in all words that can be built from it considering the minimum word length
     
  24. freedom667

    freedom667

    Joined:
    Sep 6, 2015
    Posts:
    425
    As you see, it's do not spacing.

    Column:


    Rows

    In rows, I wrote first element not zeroth and not spacing again.

    your checking method is good, it have to already, another ways won't work I think
     
    Last edited: Mar 23, 2018
  25. Pagefile

    Pagefile

    Joined:
    Feb 10, 2013
    Posts:
    51
    Forgive me if I haven't quite followed this correctly, but I think the problem likely has to do with how you're storing the state of the play area. Is it just a 2D array of characters? And if so, what's the code that populates this array when a piece is dropped? Maybe you just aren't putting any spaces in the array in the first place, so you're just copying an error that's already there.

    And I know this doesn't quite answer your question, but I'd honestly use a graph instead of an array to store the state of the board. That way you don't have to worry about storing spaces at all. Each piece will just be aware of pieces it's touching and that's it.

    Code (csharp):
    1.  
    2. // Incomplete class
    3. public class LetterPiece
    4. {
    5.     public string letter = "";
    6.     public LetterPiece left = null;
    7.     public LetterPiece right = null;
    8.     public LetterPiece up = null;
    9.     public LetteerPiece down = null;
    10.  
    11.     string GetWordRight()
    12.     {
    13.         if(right != null)
    14.         {
    15.             return letter + right.GetWordRight();
    16.         }
    17.         else
    18.         {
    19.             return letter;
    20.         }
    21.     }
    22. }
    23.  
    When a piece is dropped, you just connect all the new letters to the existing ones and then if you want to get a word, you'd pick a piece and call the appropriate function.
     
  26. freedom667

    freedom667

    Joined:
    Sep 6, 2015
    Posts:
    425
    letter blocks is 2D array. because my game is a word game of tetris. each tetrominos has letters. I put a image my before message. you can see it. if any element is null, then give space. after if empty element has a character, then space will delete and write the character of element.
     
  27. Pagefile

    Pagefile

    Joined:
    Feb 10, 2013
    Posts:
    51
    Can you post the code for how the array for the Letters Columns object is set up?
     
    Last edited: Mar 24, 2018
  28. methos5k

    methos5k

    Joined:
    Aug 3, 2015
    Posts:
    8,712
    What's the code that you use when a block lands in a spot?

    If each entry in whatever "grid/array" setup you've chosen is a string.Empty or null to begin with, then when you "place" a letter, you assign it to.. whatever you're using.

    From that "placed spot", you can check the x and y area for all connected letters, followed by finding valid words.
     
  29. freedom667

    freedom667

    Joined:
    Sep 6, 2015
    Posts:
    425
    I uploaded the scripts
     

    Attached Files:

  30. freedom667

    freedom667

    Joined:
    Sep 6, 2015
    Posts:
    425
    this is my code that's what your question.

    Code (CSharp):
    1. public void UpdateGrid(TetrisMovement tetromino)
    2.     {
    3.         for (int y = 0; y < gridHeight; y++)
    4.         {
    5.             for (int x = 0; x < gridWidth; x++)
    6.             {
    7.                 if (grid[x, y] != null)
    8.                 {
    9.                     if (grid[x, y].parent == tetromino.transform)
    10.                     {
    11.                         grid[x, y] = null;
    12.                         //lettersColumns[x].lettersRows[y] = null;
    13.                         columnsLetters[x, y] = null;
    14.                     }
    15.                 }
    16.             }
    17.         }
    18.  
    19.         foreach (Transform mino in tetromino.transform)
    20.         {
    21.             Vector2 pos = Round(mino.position);
    22.             if (pos.y < gridHeight)
    23.             {
    24.                 grid[(int)pos.x, (int)pos.y] = mino;
    25.                 columnsLetters[(int)pos.x, (int)pos.y] = mino.GetComponentInChildren<TextMeshPro>().text;
    26.                 //lettersColumns[(int)pos.x].lettersRows[(int)pos.y] = mino.GetComponentInChildren<TextMeshPro>().text;
    27.             }
    28.         }
    29.     }
    30.  
    31.     public Transform GetTransformAtGridPosition(Vector2 pos)
    32.     {
    33.         if (pos.y > gridHeight - 1)
    34.         {
    35.  
    36.             return null;
    37.         }
    38.         else
    39.         {
    40.  
    41.             return grid[(int)pos.x, (int)pos.y];
    42.         }
    43.     }
    44.  
    45.     public bool CheckInsideGrid(Vector2 pos)
    46.     {
    47.  
    48.         return ((int)pos.x >= 0 && (int)pos.x < gridWidth && (int)pos.y >= 0);
    49.     }
    50.  
    51.     public Vector2 Round(Vector2 pos)
    52.     {
    53.         return new Vector2(Mathf.Round(pos.x), Mathf.Round(pos.y));
    54.     }
    55.  
    this code is that's what I want to give space if null any array element.

    Code (CSharp):
    1. for (int i = 0; i < 10; i++)
    2.         {
    3.             for (int x = 0; x < 20; x++)
    4.             {
    5.                 rows[x] += columnsLetters[i,x]; //This takes each row in a given slot from each list and adds it on
    6.                 column[i] += columnsLetters[i,x]; //This takes all words from a given letterRows list and adds them together.
    7.                 if (columnsLetters[i,x] == null)
    8.                 {
    9.                     rows[x] += " ";
    10.                     column[i] += " ";
    11.                 }
    12.                 else
    13.                 {
    14.                     column[i] = "";
    15.                     rows[i] = "";
    16.                 }
    17.             }
    18.         }
    but I think this code not control any element, just controlling all elements, sure some elements are not null, therefore the code does not give space.
     
  31. methos5k

    methos5k

    Joined:
    Aug 3, 2015
    Posts:
    8,712
    Is the second script supposed to form words?

    Are you successful in being able to move a character into position and know it's position inside the array, so far in your code?
     
  32. freedom667

    freedom667

    Joined:
    Sep 6, 2015
    Posts:
    425
    I uploaded all scripts. if you want you can take a look. when the blocks(tetrominos) are placed, second script write the letters in the array. my scripts are above my message before
     
  33. methos5k

    methos5k

    Joined:
    Aug 3, 2015
    Posts:
    8,712
    Ya, well what I was asking was if you get the correct character when it's place, and it's at a location in your array, your already have a "string".

    That being said, I believe the relevant part is to search from the newly placed character to find the horizontal and vertical words -- beginning where it was placed and reaching out left/right, up/down until your first null.
     
  34. Pagefile

    Pagefile

    Joined:
    Feb 10, 2013
    Posts:
    51
    As far as the spacing goes when copying the letter into the rows[] and column[] arrays, if you try to add null to a string it acts as an empty string, or "". In columnsLetters[] array, try initializing all elements to " " (a string with a space), and anytime a letter is removed, set the value to " " instead of null.
     
  35. freedom667

    freedom667

    Joined:
    Sep 6, 2015
    Posts:
    425
    I wrote this in Start() method:
    Code (CSharp):
    1. columnsLetters[10, 20] = " ";
    but giving "array index out of range" error
     
  36. Pagefile

    Pagefile

    Joined:
    Feb 10, 2013
    Posts:
    51
    That's because it is out of range. Array indexing starts at 0, so it goes from columnsLetters[0, 0] to columnsLetters[9, 19]. That line alone will also only set the element at [9, 19] to " " and nothing else. AFAIK, there's no super simple way to initialize an entire array to a chosen value. You either initialize each element individually in a list, or use a for loop
    Code (csharp):
    1. for(int x = 0; x < gridWidth; x++)
    2. {
    3.     for(int y = 0; y < gridHeight; y++)
    4.     {
    5.         columnsLetters[x, y] = " ";
    6.     }
    7. }
     
  37. freedom667

    freedom667

    Joined:
    Sep 6, 2015
    Posts:
    425
    yes it works. only left checking words and destroy matched word blocks
     
  38. freedom667

    freedom667

    Joined:
    Sep 6, 2015
    Posts:
    425
    I'm checking the words but I failed again.

    Code (CSharp):
    1. for (int k = 0; k < answers.Length; k++)
    2.                 {
    3.                     if (rows[x].Contains(answers[k]) && column[i].Contains(answers[k]))
    4.                     {
    5.                         Debug.Log("true");
    6.                     }
    7.                 }
    e.g. "EUQPDOGAFO" there is a word "DOG" I wrote above code. I think contains does not work. Actully it have to because, when i work for string functions, then it did worked there. but on me did not work. contains method not working at arrays?
     
  39. methos5k

    methos5k

    Joined:
    Aug 3, 2015
    Posts:
    8,712
    Perhaps it's the logic that's not working.
    Are rows the letters across and column the letters down in your game?
     
  40. methos5k

    methos5k

    Joined:
    Aug 3, 2015
    Posts:
    8,712
    There are also some other issues with your code. If you're comparing words to an actual dictionary of known words, your process is : very slow + not able to discern the "longest" match.

    Assuming the logic had been fixed**
     
  41. freedom667

    freedom667

    Joined:
    Sep 6, 2015
    Posts:
    425
    OK. but what will i use method instead of Contains? answers are in string array. I have to compare in it. the letters are written joint. I have searched some methods but there are always contains methods.

    Edit: I think my method comparing all answers. I mean zeroth element is "DOG", first element is "CAT". so its comparing all of these like "DOGCAT" in any rows element. right?
     
  42. methos5k

    methos5k

    Joined:
    Aug 3, 2015
    Posts:
    8,712
    Well, did you understand about the logic error? You're asking if the row and the column contains an 'answer' entry. So, that would only be true if both did. 'contains' is not broken. :)

    As for what else you can do, is you can create a hashset for the answers.

    And as for what you can do for determining the longer lengths, a couple of ideas come to mind:
    a) compare them in order from longest to shortest, and your first hit is the "winner"
    b) compare them in a less ordered fashion, but on a match, store the length and word (or starting index + len). At the end of comparing every valid possibility, you'll have the most up-to-date answer.
     
  43. Pagefile

    Pagefile

    Joined:
    Feb 10, 2013
    Posts:
    51
    String compares are case sensitive. "DOG" == "dog" will return false. You can use string.ToLower() when comparing, but that will slow things down, so you should try to make sure they're case matches when the game loads.

    As for finding words, a brute force approach is going to be very slow, and get much slower with each word you are trying to check against. I think if you could store the dictionary as a sort of tree with each level being a letter of a valid word, you should be able to get fast search times. If you do it right, I think the operation time would be O(n), where n is the length of the word.

    Edit: I would also sugguest only checking pieces that have had any change in potential words they make up instead of the whole board. Essentially, any space that has a piece placed into it will need to check in a plus pattern around itself till it reaches a gap in pieces
     
    Last edited: Mar 25, 2018
  44. freedom667

    freedom667

    Joined:
    Sep 6, 2015
    Posts:
    425
    I think it works now with this method. I hope it not exists any problem.

    Code (CSharp):
    1. foreach (string item in answers)
    2.                 {
    3.                     System.Text.RegularExpressions.Regex reg = new System.Text.RegularExpressions.Regex(item);
    4.                     if (reg.Match(rows[x]).Success)
    5.                     {
    6.                         Debug.Log("true");
    7.                     }
    8.                 }
    9.  
    10.                 foreach (string item in strResult)
    11.                 {
    12.                     System.Text.RegularExpressions.Regex reg = new System.Text.RegularExpressions.Regex(item);
    13.                     if (reg.Match(column[i]).Success)
    14.                     {
    15.                         Debug.Log("true");
    16.                     }
    17.                 }
    Now left destroying and deleting matched letters to words
     
  45. freedom667

    freedom667

    Joined:
    Sep 6, 2015
    Posts:
    425
    I'm working on destroying matching block. I trying destroy method with colors. because, when letter blocks are matched, then the colors of blocks will green. but I don't know how to change colors matched letters.

    Code (CSharp):
    1.     public void WriteText()
    2.     {
    3.         for (int i = 0; i < 10; i++)
    4.         {
    5.             for (int x = 0; x < 20; x++)
    6.             {
    7.                 rows[x] += columnsLetters[i,x]; //This takes each row in a given slot from each list and adds it on
    8.                 column[i] += columnsLetters[i,x]; //This takes all words from a given letterRows list and adds them together.
    9.  
    10.                 foreach (string item in answers)
    11.                 {
    12.                     System.Text.RegularExpressions.Regex reg = new System.Text.RegularExpressions.Regex(item);
    13.                     if (reg.Match(rows[x]).Success)
    14.                     {
    15.                         Debug.Log("true");
    16.  
    17.                     }
    18.                 }
    19.  
    20.                 foreach (string item in strResult)
    21.                 {
    22.                     System.Text.RegularExpressions.Regex reg = new System.Text.RegularExpressions.Regex(item);
    23.                     if (reg.Match(column[i]).Success)
    24.                     {
    25.                         Debug.Log("true");
    26.                     }
    27.                 }
    28.             }
    29.         }
    30.     }
    31.  
    32.     public GameController(TetrominoColors tetrominoColors)
    33.     {
    34.         if (color == tetrominoColors.GetComponentInChildren<SpriteRenderer>().color)
    35.         {
    36.             matchedWords.Add(tetrominoColors);
    37.         }
    38.     }
    39.  
    40.     void DestroyMatchingBlocks()
    41.     {
    42.         foreach (TetrominoColors block in matchedWords)
    43.         {
    44.             Destroy(block);
    45.         }
    46.  
    47.         matchedWords.Clear();
    48.         matchedWords = null;
    49.     }