Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public void rotateAnts(){
- for(Ant ant : ants){
- if(ant.antState.equals(AntState.EAST)){
- if(cellState.equals(BinaryState.ALIVE)){
- ant.antState=AntState.SOUTH;
- }
- else{
- ant.antState=AntState.NORTH;
- }
- }
- else if(ant.antState.equals(AntState.NORTH)){
- if(cellState.equals(BinaryState.ALIVE)){
- ant.antState=AntState.EAST;
- }
- else{
- ant.antState=AntState.WEST;
- }
- }
- else if(ant.antState.equals(AntState.WEST)){
- if(cellState.equals(BinaryState.ALIVE)){
- ant.antState=AntState.NORTH;
- }
- else{
- ant.antState=AntState.SOUTH;
- }
- }
- else{
- if(cellState.equals(BinaryState.ALIVE)){
- ant.antState=AntState.WEST;
- }
- else{
- ant.antState=AntState.EAST;
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement