cellular automaton (A 1D CA)
I need some help and guidance for my next part of the assignment. heres the link to the assignment:
http://i51.tinypic.com/aenp8h.jpg
and here is what I have so far, I know its not correct so I would like some comments and suggestions on how to approach this... I am new and am still learning.
Code:
public class Cell extends DecToBinArray{
private int l;
private int r;
private int s= null;
public int currentState()
public char left(char l){return l;}
public char right(char r){return r;}
public void setNeighbors(Cell left, Cell right){ l =left; r =right;}
public void setState(int state){
if(s.equals(state)){
return false;
}else{
state = s;
return true
}
public int nextState(DecToBinArray ruleSet)
public int updateState()
}
Re: cellular automaton (A 1D CA)
That code doesn't even compile; without knowing any details we don't what to reply ...
kind regards,
Jos
Re: cellular automaton (A 1D CA)
theres a link to the assignment of part one, the cell class. Members functions are given, but I need help getting started and how to define these member or if I'm doing it right.
Re: cellular automaton (A 1D CA)
You need to check your notes on how to declare variables and methods, how to create classes. If your notes are insufficient, you can always check the Oracle Java tutorials here: Java Tutorials
Re: cellular automaton (A 1D CA)
I know how to declare variable and create classes.... just need help with the thinking process of how to approach the assignment to make the class. What variable I need and how to define the members.
Re: cellular automaton (A 1D CA)
For one thing, I can't even read what is in that jpeg, so I can't help you any further. Feel free to post the details here.
kind regards,
Jos
Re: cellular automaton (A 1D CA)
basically the program has the same concept as "Conway's Game of Life". Design and implement the following classes to simulate 1D cellular automata.
Cell: This class abstract the cell used in 1D CA. Cell should have atleast the following members:
currentState: current state of a cell
nextState(): next state of a cell
Left(): left neighbor
Right(): right neighbor
SetNeighbor(Cell left, Cell right):sets neighboring cells of a cell
SetState(int state):set the current state of a cell
nextState(DecToBinArray ruleSet): calculate the state of a cell for next generation
updateState():updates currrent state for next generation