Scroling bug eliminated
This commit is contained in:
parent
d6c720b14f
commit
44dcf006b1
32
gol.c
32
gol.c
@ -31,17 +31,17 @@ void simulate_grid(bool grid[SIZE][SIZE], bool mirror[SIZE][SIZE]){
|
|||||||
for(int j = 0; j < SIZE; j++){
|
for(int j = 0; j < SIZE; j++){
|
||||||
int neighbours = 0;
|
int neighbours = 0;
|
||||||
|
|
||||||
int nx_prawo = i == SIZE ? 0 : i + 1;
|
int nx_prawo = i == SIZE-1 ? 0 : i + 1;
|
||||||
int ny_prawo = j;
|
int ny_prawo = j;
|
||||||
|
|
||||||
int nx_lewo = i == 0 ? SIZE : i - 1;
|
int nx_lewo = i == 0 ? SIZE-1 : i - 1;
|
||||||
int ny_lewo = j;
|
int ny_lewo = j;
|
||||||
|
|
||||||
int nx_gora = i;
|
int nx_gora = i;
|
||||||
int ny_gora = j == 0 ? SIZE : j - 1;
|
int ny_gora = j == 0 ? SIZE-1 : j - 1;
|
||||||
|
|
||||||
int nx_dol = i;
|
int nx_dol = i;
|
||||||
int ny_dol = j == SIZE ? 0 : j + 1;
|
int ny_dol = j == SIZE-1 ? 0 : j + 1;
|
||||||
|
|
||||||
neighbours = mirror[nx_prawo][ny_prawo] == true ? neighbours + 1 : neighbours;
|
neighbours = mirror[nx_prawo][ny_prawo] == true ? neighbours + 1 : neighbours;
|
||||||
neighbours = mirror[nx_lewo][ny_lewo] == true ? neighbours + 1 : neighbours;
|
neighbours = mirror[nx_lewo][ny_lewo] == true ? neighbours + 1 : neighbours;
|
||||||
@ -98,19 +98,19 @@ int main()
|
|||||||
initialize_grid(grid);
|
initialize_grid(grid);
|
||||||
mirror_grid(grid, mirror);
|
mirror_grid(grid, mirror);
|
||||||
|
|
||||||
//grid[SIZE/2][SIZE/2] = true; //drawing famous glider
|
grid[SIZE/2][SIZE/2] = true; //drawing famous glider
|
||||||
//grid[(SIZE/2)+1][(SIZE/2)+1] = true;
|
grid[(SIZE/2)+1][(SIZE/2)+1] = true;
|
||||||
//grid[(SIZE/2)-1][(SIZE/2)+2] = true;
|
grid[(SIZE/2)-1][(SIZE/2)+2] = true;
|
||||||
//grid[(SIZE/2)+0][(SIZE/2)+2] = true;
|
grid[(SIZE/2)+0][(SIZE/2)+2] = true;
|
||||||
//grid[(SIZE/2)+1][(SIZE/2)+2] = true;
|
grid[(SIZE/2)+1][(SIZE/2)+2] = true;
|
||||||
|
|
||||||
grid[(SIZE/2)][(SIZE/2)] = true; //funny pattern
|
//grid[(SIZE/2)][(SIZE/2)] = true; //funny pattern
|
||||||
grid[(SIZE/2)+1][(SIZE/2)] = true;
|
//grid[(SIZE/2)+1][(SIZE/2)] = true;
|
||||||
grid[(SIZE/2)+1][(SIZE/2)-1] = true;
|
//grid[(SIZE/2)+1][(SIZE/2)-1] = true;
|
||||||
grid[(SIZE/2)+1][(SIZE/2)-2] = true;
|
//grid[(SIZE/2)+1][(SIZE/2)-2] = true;
|
||||||
grid[(SIZE/2)-1][(SIZE/2)] = true;
|
//grid[(SIZE/2)-1][(SIZE/2)] = true;
|
||||||
grid[(SIZE/2)-1][(SIZE/2)-1] = true;
|
//grid[(SIZE/2)-1][(SIZE/2)-1] = true;
|
||||||
grid[(SIZE/2)-1][(SIZE/2)-2] = true;
|
//grid[(SIZE/2)-1][(SIZE/2)-2] = true;
|
||||||
|
|
||||||
InitWindow(WIDTH, HEIGHT, TITLE);
|
InitWindow(WIDTH, HEIGHT, TITLE);
|
||||||
SetTargetFPS(FPS);
|
SetTargetFPS(FPS);
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user