Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

Game of dicks

Name: Anonymous 2009-12-06 13:11


live() {
 for(int i = 0; i < w; i++) {
 for(int j = 0; j < h; j++) {
  n[i][j] = neighbours(i,j);
  board[i][j] =
   board[i][j]
    ? (n[i][j] == 2 || n[i][j] == 2)
    : (n[i][j] == 3)
 }
 }


motherfuckers, I can't get my game of life working. Help me you assholes. live is meant to do one iteration but it's fucked up somehow.

Name: Anonymous 2009-12-08 11:15

>>33-1000
This thread has been threadstopped, you can't reply anymore

Name: Anonymous 2009-12-08 11:55

dicks

Name: Anonymous 2009-12-08 14:07

* crickets chirping *

Name: Anonymous 2009-12-08 14:19

This thread has been threadstopped, you can't crickets anymore

Name: Anonymous 2009-12-08 14:36

>>18
I still say your problem must have to do with the initialization of your variables w, h, or the arrays board and n.  Or neighbours(in, int) just doesn't work like you think it does at some point.

>>21
It's like this.  Just remember that board is a boolean array.

if(board[i][j])
{
   board[i][j] = (n[i][j] == 2 || n[i][j] == 3);
}
else
{
   board[i][j] = (n[i][j] == 3);
}

Name: Anonymous 2009-12-08 14:55

EVERYTHING HAS ALREADY BEEN ANSWERED IN >>24 BECAUSE I WROTE IT

Name: Anonymous 2009-12-08 15:23

>>38
ANSWER MY ANUS

Name: Anonymous 2009-12-10 16:05

anyone got a tip this is due today

Name: Sage Master Sage 2009-12-10 16:10

>>40
Tip: Do your own fucking homework.

Name: Anonymous 2009-12-10 16:15

>>1
You didn't explain any other part of the program, so who knows or cares what's wrong.

Name: Anonymous 2009-12-10 16:18

>>24
actually in already answered it in >>7

Name: Anonymous 2009-12-10 17:07

>>43
In >>7 you're implying creating a new board for each generations, so that the memory cost of your solution is O(n). My proposition in >>24 has a memory cost of O(1).

Name: Anonymous 2009-12-10 17:15

>>44
If you discard the boards when you are finished with them, they should be functionally equivalent. Later, if you wanted to, for example, play back the game, then >>7s solution is better. For a simple first go, I'd double buffer, as you suggested.

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List