Tic Tac Woe

ZX80, ZX 81, ZX Spectrum, TS2068 and other clones
Post Reply
User avatar
DanDoore
New member
Posts: 2
Joined: Sun May 02, 2021 1:50 pm

Tic Tac Woe

Post by DanDoore »

I am trying to have a go at getting Marcello Zaniboni's AI Tic Tac Toe https://www.marcellozaniboni.net/zxaittt/index.html working under the recently pimped-up SAM Coupé target but am getting screen corruption when running it, so I went back to the original ZX target and it seems to do the same, albeit in a slightly different way:

ZX: https://www.dropbox.com/s/ka7xfvx5l72qddo/ttt.png?dl=0

SAM: https://www.dropbox.com/s/1x8vzcu76dt7s ... 4.png?dl=0

It clearly used to compile and work under Z88DK (albeit in 2005) so is the code abusing something in Z88DK's printing routines - I can't see it doing anything paticulary naughty - or just plain broken?

Dan.
User avatar
DanDoore
New member
Posts: 2
Joined: Sun May 02, 2021 1:50 pm

Re: Tic Tac Woe

Post by DanDoore »

Went and had a run and thought about this - I think it's this section:

Code: Select all

/* print an int at column c and row r */
void printIntAt(int c, int r, int value) {
    #if defined SPECTRUM 
        signed char buffer[5];
        itoa(buffer, value,0);
        printAt(c, r, buffer);
    #else
        printf("\nFIX ME! (%d)\n", value);
    #endif
}
It doesn't like the itoa() bit - If I replace it with a copy of the printAt(c, r, string) routine but for integers it's fine.

Onwards...

Dan.
stefano
Well known member
Posts: 1664
Joined: Mon Jul 16, 2007 7:39 pm

Re: Tic Tac Woe

Post by stefano »

That's due to a closer compliance to the POSIX C syntax, itoa() now works the way it should ;)
Post Reply