Tic Tac Toe--how to check for win

I am making a 3D tic tac toe, where a 3x3x3 cube holds blue and red placemarkers instead of Xs and Os. The lines can go up, down, straight, diagonal, etc. I have code that checks whether three placemarkers of the same color are in a row. Each block checks for blocks around itself. If they are the same color, a vector is made with these two blocks, creating a line. Then I use this line to raycast for another block to make a threesome. I have managed to get the script to recognize two in a row, but not three. I’m guessing it has to do with either the vectors or the casts. Here is my code(C#):

public bool checkRow(string t){
		Collider[] col = Physics.OverlapSphere(transform.position, 0.9F);
		foreach (Collider c in col){
			if (c != collider && c.CompareTag (t)){  //check if neighbor and same color
				Debug.Log ("Found neighbor");
				Vector3 oneDir = c.transform.position - transform.position;
				oneDir.Normalize();
				Ray r = new Ray(c.transform.position, oneDir);
				RaycastHit hit;
				if (c.Raycast(r, out hit, 0.9F)){
					Vector3 twoDir = hit.transform.position - transform.position;
					twoDir.Normalize();
					if (Vector3.Angle(oneDir, twoDir) < 5 && hit.transform.CompareTag(t)) //if the row is straight and the last one has the same color)
						return true;
				}
			}
		}
		return false;
	}

What could it be missing?

It would be much simpler just to use an array, instead of trying to get raycasting and so on to work for this. Then you just check the relevant positions in the array. You’d only use GameObjects to reflect the state of the array, so you can dispense with colliders, physics, etc.

Alright, I was finally inspired with the answer. The problem was that the raycast hit triggers that I thought would not be hit (but obviously did). So I used a layerMask to avoid this (uses Physics.Raycast() now) and increased the distance. Now it can get all the lines without having to have 50 cases for each possible line. Sorry about the confusion.

But, Eric was right; I made a three dimensional array, and had two for loops to check all the possibilities. It was way faster than my Raycast check. Thanks, Eric.