AI Not Drawing

I'm currently trying to create a Tic Tac Toe AI. So far it's going fairly well however for some reason an X won't draw when I click and O to two locations- the 6th and 7th spots(counting from the top, left to right, starting at 1). When I click any other location the computer will draw an X where I want it, but when I click those two locations an X won't draw. Here's the code in question (there's more, but none of it is relevant to the problem). occupationState, for those wondering, is the array I'm using to draw the board and vert is just a ghetto fix for a problem I was having with drawing to the proper location. A value of 1 in occupationState will tell the computer to draw an O in that location, a value of 2 will tell the computer to draw a value of X at that location.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
for(int i = 0; i <9; i++)
		{
			if(i==0 || i==1 || i==2)
				vert = 0;
			if(i==3 || i==4 || i==5)
				vert = 300;
			if(i==6 || i==7 || i==8)
				vert = 600;
			if(occupationState[i] == 1)
			{
				O->setLocation(5+((i%3)*150),5+(vert-((i/3)*150)));
				O->drawImage(screen);
			}
			if(occupationState[i] == 2)
			{
				X->setLocation(5+((i%3)*150),5+(vert-((i/3)*150)));
				X->drawImage(screen);
			}
		}

	

		
		if(CompTurn)
		{
			if(occupationState[1]==1)
			{
				occupationState[3]=2;
			}
			else if (occupationState[2]==1)
			{
				occupationState[3]=2;
			}
			else if (occupationState[3]==1)
			{
				occupationState[1]=2;
			}
			else if (occupationState[4]==1)
			{
				occupationState[8]=2;
			}
			else if (occupationState[5]==1)
			{
				occupationState[6]==2;
			}
			else if (occupationState[6]==1)
			{
				occupationState[1]==2;
			}
			else if (occupationState[7]==1)
			{
				occupationState[8]=2;
			}
			else if(occupationState[8]==1)
			{
				occupationState[2]=2;
			}

		}
Topic archived. No new replies allowed.