Anyways, the program flow seems faulty. When the computer makes his move, it generates a random number between 1 and 9. It checks that location. If there is something there already (0 or X) it calls again(). Again() generates a new number and calls the CPup() again... but yet a new number is generated at the top of CPUp()...

Originally Posted by brewbuck:Reimplementing a large system in another language to get a 25% performance boost is nonsense. It would be cheaper to just get a computer which is 25% faster.

Because backup never gets initiated. And i'm guessing that the while(cpu_line==backup) loop is supposed to keep looping until you get something for cpu_line that isn't the value you just tried. So therefore you want backup to equal the value that cpu_line just had. Make sense?

Now that its working, you should consider trying to get rid of the again() function as an exercise. That design will cause problems if you use it more complex games (if there is only one space left you could easily get a stack overflow). It shouldn't be too hard to get it to work with a single while loop, so it might be worth it to try.