I have this data
![alt text][1]
As you can see there’s a 2nd board there.
Now what i want is something like this
PSEUDO CODE
If the first boards table[1,1] is not `NULL` and it has Green value then we will start at the 2nd
column.
Now if column 0 has the same length as column 1
Next to this rule is compare the 2nd column 1st
row to 1st column 1st row if they are the same in length
Next to this the 2nd column 2nd row
compare it again to the 1st column 2nd row and so on.
If we are always on the top row like the 3rd
column 1st row(0 index) we will compare the 2nd column 1st row(0 index) to 1st column 1st row(0
index)
then display in the 2nd board a blue circle if it is the same in length if
not red circle.
But if the table[1,1] is not`NULL` and not Green value then I need to compare 1st column and
2nd column if they have the same length
then display in the 2nd board a blue circle if it is the same in length if
not red circle
END PSEUDO CODE
Here’s by the way my code of getting the BIG ROAD
string[,] table = new string[104, 6];
int xIndex = 0;
int yIndex = 0;
string newPrevious = "placeholder";
//P = BLUE, B = RED, T = GREEN
string[] strData = { "P ,P ,P ,B ,T ,P ,P B,P ,P ,P ,B ,B ,T ,B ,P ,T ,P " };
string OriginalData = "";
void Start()
{
StartCoroutine("Win_Log");
}
IEnumerator Win_Log()
{
yield return new WaitForEndOfFrame();
for (int i = 0; i < strData.Length; i++)
{
OriginalData += strData*;*
OriginalData += “,”;
}
string[] newNewData = OriginalData.Split(‘,’);
string result = “”;
string previous = “”;
int counterForTie = 0;
int counterForRow = 1;
int justMoveToY = 1;
int moveRow = 1;
int moveCol = 1;
foreach (string newStrData in newNewData)
{
//Debug.Log("This is the data : " + newStrData);
GameObject o = Instantiate(prefab_gameobject) as GameObject;
o.transform.SetParent(pos_big_road);
o.transform.localScale = Vector3.one;
img = (RawImage)o.GetComponent();
//check the length so that it won’t throw an exception
if (newStrData.Length > 1)
{
//get only the first letter of the value P,B,T
result = newStrData.Substring(0, 1);
}
else
{
result = “”;
}
#region BIG ROAD
if (table.GetLength(0) < xIndex)
{
break;
}
if (result.Equals(newPrevious) || result.Equals(“T”) && yIndex < table.GetLength(1))
{
if (counterForRow == 1)
{
yIndex = 0;
counterForTie++;
table[xIndex, yIndex] = result;
counterForRow++;
}
else
{
yIndex += 1;
counterForTie++;
table[xIndex, yIndex] = result;
}
}
else if (result.Equals(newPrevious) && previous.Equals(“T”) && yIndex < table.GetLength(1))
{
yIndex += 1;
counterForTie++;
table[xIndex, yIndex] = result;
}
else
{
if (justMoveToY == 1 && counterForRow == 1)
{
xIndex = 0;
yIndex = 0;
table[xIndex, yIndex] = result;
justMoveToY++;
counterForRow++;
}
else if (justMoveToY == 1)
{
xIndex = 0;
yIndex += 1;
table[xIndex, yIndex] = result;
justMoveToY++;
}
else
{
xIndex += 1;
yIndex = 0;
table[xIndex, yIndex] = result;
counterForTie = 0;
}
}
previous = result;
if (!result.Equals(“T”))
{
newPrevious = previous;
}
if (counterForTie < 6)
{
o.transform.localPosition = new Vector3(xIndex * 56, yIndex * -45, 0f);
}
else
{
int reminder = counterForTie % 5;
o.transform.localPosition = new Vector3((xIndex + reminder) * 93, -465, 0f);
}
#region CONDITION
if (newStrData.Contains(scoreBoard[0]))
{
img.texture = NewTexture[0];
o.SetActive(true);
}
if (newStrData.Contains(scoreBoard[1]))
{
img.texture = NewTexture[1];
o.SetActive(true);
}
if (newStrData.Contains(scoreBoard[2]))
{
img.texture = NewTexture[2];
o.SetActive(true);
}
if (newStrData.Contains(scoreBoard[3]))
{
img.texture = NewTexture[0];
o.SetActive(true);
}
if (newStrData.Contains(scoreBoard[4]))
{
img.texture = NewTexture[1];
o.SetActive(true);
}
#endregion