From 164681f4e65904ae6996dc67aaad30e1d590f3a1 Mon Sep 17 00:00:00 2001 From: Cracker64 Date: Sat, 8 Jan 2011 17:55:14 -0500 Subject: [PATCH] GoL speed improvements from jacksonmj (thank you very much) --- src/powder.c | 46 ++++++---------------------------------------- 1 file changed, 6 insertions(+), 40 deletions(-) diff --git a/src/powder.c b/src/powder.c index b999b3690..ab546807c 100644 --- a/src/powder.c +++ b/src/powder.c @@ -1236,8 +1236,8 @@ void update_particles_i(pixel *vid, int start, int inc) if(ISGOL==1&&CGOL>=GSPEED)//GSPEED is frames per generation { int createdsomething = 0; - for(nx=4;nx=XRES-4){ - gol2[4][YRES-5][golnum] ++; - gol2[4][YRES-5][0] ++; - } - else if(ny+nny>=YRES-4&&nx+nnx<4){ - gol2[XRES-5][4][golnum] ++; - gol2[XRES-5][4][0] ++; - } - else if(nx+nnx<4){ - gol2[XRES-5][ny+nny][golnum] ++; - gol2[XRES-5][ny+nny][0] ++; - } - else if(ny+nny<4){ - gol2[nx+nnx][YRES-5][golnum] ++; - gol2[nx+nnx][YRES-5][0] ++; - } - else if(ny+nny>=YRES-4&&nx+nnx>=XRES-4){ - gol2[4][4][golnum] ++; - gol2[4][4][0] ++; - } - else if(ny+nny>=YRES-4){ - gol2[nx+nnx][4][golnum] ++; - gol2[nx+nnx][4][0] ++; - } - else if(nx+nnx>=XRES-4){ - gol2[4][ny+nny][golnum] ++; - gol2[4][ny+nny][0] ++; - } - else{ - gol2[nx+nnx][ny+nny][golnum] ++; - gol2[nx+nnx][ny+nny][0] ++; - } + gol2[((nx+nnx+XRES-3*CELL)%(XRES-2*CELL))+CELL][((ny+nny+YRES-3*CELL)%(YRES-2*CELL))+CELL][golnum] ++; + gol2[((nx+nnx+XRES-3*CELL)%(XRES-2*CELL))+CELL][((ny+nny+YRES-3*CELL)%(YRES-2*CELL))+CELL][0] ++; } } } - for(nx=4;nx