Hallo,
ich versuche, Torus Moore Nachbarschaft für Game of Live zu berechnen. Ich zerbreche mir den Kopf darüber ganzen Tag, leider gelingt mir es nicht. Falls jemand mir Hinweise oder sagen könnte, wie ich das berechnen kann, würde mir sehr geholfen.
Mit freundlichen Grüßen
ich versuche, Torus Moore Nachbarschaft für Game of Live zu berechnen. Ich zerbreche mir den Kopf darüber ganzen Tag, leider gelingt mir es nicht. Falls jemand mir Hinweise oder sagen könnte, wie ich das berechnen kann, würde mir sehr geholfen.
Mit freundlichen Grüßen
Java:
private Cell[] getTorusMoorNeighbors(int row, int col){
List<Cell> list = new ArrayList<>();
int tempRow = row % this.ROWS;
int tempRows = this.ROWS - 1 % this.ROWS;
int tempCol = col % this.COLUMNS;
int tempCOLUMNS = this.COLUMNS - 1 % this.COLUMNS;
int result_Of_tempRow_And_Rows = tempRow + tempRows;
int result_Of_tempCol_And_Columns = tempCol + tempCOLUMNS;
list.add(this.cells[result_Of_tempRow_And_Rows][result_Of_tempCol_And_Columns]);
list.add(this.cells[result_Of_tempRow_And_Rows][tempCol]);
//TODO
return list.toArray(new Cell[8]);
}