Skip to content

Instantly share code, notes, and snippets.

@swapnilshrikhande
Last active December 31, 2016 03:36
Show Gist options
  • Save swapnilshrikhande/290c7a8dd0326f5a04e517672cc4c7c6 to your computer and use it in GitHub Desktop.
Save swapnilshrikhande/290c7a8dd0326f5a04e517672cc4c7c6 to your computer and use it in GitHub Desktop.
public interface Organism {
}
public interface Part {
List<Limb>
}
public interface Limb {
//can be composed of Cells
List<Cell> cells;
}
public Interface Cell {
private Map<String,Object> state;
private Map<String,EventReaction> eventResponses;
public Cell(){
state = new Map<String,Object>();
}
public Cell(Map<String,Object> stateP){
this.state = stateP;
}
public Integer remember(String key,Object value)
//teach cell how to
public Integer learn(String event,EventReaction reaction);
//triggers/calls a event which will help cell react in a particular way
public Map<String,Object> call(String event);
public Cell reproduce(Cell papa);
public List<Cell> reproduceMany(Cell papa,Integer count);
}
public Interface EventReaction {
public Map<String,Object> react(Map<String,Object> state);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment