Cuzzie's Profile
Reputation: 72
Whiz
- Group:
- Contributors
- Active Posts:
- 338 (0.32 per day)
- Joined:
- 16-July 10
- Profile Views:
- 5,108
- Last Active:
Sep 18 2012 08:29 AM- Currently:
- Offline
Previous Fields
- Country:
- MY
- OS Preference:
- Linux
- Favorite Browser:
- Chrome
- Favorite Processor:
- Who Cares
- Favorite Gaming Platform:
- Who Cares
- Your Car:
- Who Cares
- Dream Kudos:
- 50
Posts I've Made
-
In Topic: Help with understanding my current coding of boolean array
Posted 13 Sep 2012
programmingdoesmyheadin, on 14 September 2012 - 01:07 AM, said:Okay, I think i've figured it out...
Except, i just don't know what to put instead of 1,1 considering we dont know how many rows and cols there are?
any suggestions?
public static boolean[][] nextGeneration(boolean[][] board1) { int row=0; int col=0; boolean [][] newBoard = new boolean[board1.length] [board1[row].length]; int count = countNeighbours(newBoard, 1, 1); if (count < 2 || count > 3) { newBoard[row][col] = board1[row][col]; newBoard[row][col] = false; } else if (count == 2 || count == 3) { newBoard[row][col] = board1[row][col]; newBoard[row][col] = true; } return newBoard; }
DOES THAT ANSWER THE QUESTION THOUGH?
It compiles but I'm not sure if it answers the question
You are assigning 0 to both row and col in the method, so that means every time you call the method, you will only be modifying newBoard[0][0].
programmingdoesmyheadin, on 14 September 2012 - 01:18 AM, said:is this bit necessary within both if statements or not?
newBoard[row][col] = board1[row][col];
newBoard[row][col] = board1[row][col]; newBoard[row][col] = false;
The value of board1[row][col] that you assign to newBoard[row][col] will be replaced by "false" straight away. -
In Topic: Help with understanding my current coding of boolean array
Posted 13 Sep 2012
programmingdoesmyheadin, on 13 September 2012 - 11:23 AM, said:That's basically what I had done so far but the problem I'm really having with the code is the method !
I don't know how to go about writing it.. I dont even know how to start 
Which methods are you having problems with? nextGeneration? countNeighbours? Or something else? -
In Topic: Movies you should avoid
Posted 13 Sep 2012
Avoid Sucker Punch and Haywire.. worst films I've ever come across! -
In Topic: Song of the day
Posted 13 Sep 2012
-
In Topic: Games you play after a long time of coding
Posted 13 Sep 2012
Well, the last time I played games, I was playing Braid and Plant vs Zombies. Braid was so awesome!
My Information
- Member Title:
- D.I.C Regular
- Age:
- Age Unknown
- Birthday:
- Birthday Unknown
- Gender:
-
Contact Information
- E-mail:
- Private
|
|


Find Topics
Find Posts
View Reputation Given



|
Comments
Cuzzie
16 Aug 2010 - 01:59Simown
15 Aug 2010 - 11:30hannan89
15 Aug 2010 - 05:02Cuzzie
11 Aug 2010 - 06:02Codebug
10 Aug 2010 - 18:18