Computer Science Canada connect 5 |
Author: | person [ Sun Feb 06, 2005 10:54 am ] | ||
Post subject: | connect 5 | ||
i did a connect 5 game... i still need to make the AI better
btw..does anyone know a way of making it run faster? |
Author: | ssr [ Wed Feb 09, 2005 8:27 pm ] |
Post subject: | |
There are few bugs 1. Well Not really a bug, just the AI is Sooooooooooooooo easy to beat. 2. Yes It is going really slow, I think its because there are too mnay loops 3. Somehow, the computer doesnt stop after "u win!" Hopefully to c u update soon, it would be a fun game |
Author: | Cervantes [ Thu Feb 10, 2005 5:31 pm ] |
Post subject: | |
I've only glanced at the code, but it seems you are checking every single pixel and comparing it to every pixel around it (that is, 80 pixels away from it in each direction). Don't. That's madness. Instead, just check the pixels at the centres of each grid location. It would be best if you stored all your information in terms of locations on the grid. To elaborate, that would mean that the top right corner would be (7,7), and the bottom left corner would be (1,1). Use those values throughout your program, and when you want to draw the pieces, draw them at (x * gridXSize + gridXSize / 2, y * gridYSize + gridYSize / y). Also, this approach means you ditch whatdotcolour, so there's another bonus. 8) (The way to go would simply be to compare each spot (ex. (6,5)) to each spot around it (ex 6,6)).) |
Author: | ssr [ Thu Feb 10, 2005 11:36 pm ] |
Post subject: | |
I think I've heard somthign about a connect 4, that make an array, and store all the info about each square, it would look better I guess ( the code I mean) 8) |