Advertisement
Coriic

Untitled

Dec 5th, 2016
94
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.78 KB | None | 0 0
  1. public void rotateAnts(){
  2. for(Ant ant : ants){
  3. if(ant.antState.equals(AntState.EAST)){
  4. if(cellState.equals(BinaryState.ALIVE)){
  5. ant.antState=AntState.SOUTH;
  6. }
  7. else{
  8. ant.antState=AntState.NORTH;
  9. }
  10. }
  11. else if(ant.antState.equals(AntState.NORTH)){
  12. if(cellState.equals(BinaryState.ALIVE)){
  13. ant.antState=AntState.EAST;
  14. }
  15. else{
  16. ant.antState=AntState.WEST;
  17. }
  18. }
  19. else if(ant.antState.equals(AntState.WEST)){
  20. if(cellState.equals(BinaryState.ALIVE)){
  21. ant.antState=AntState.NORTH;
  22. }
  23. else{
  24. ant.antState=AntState.SOUTH;
  25. }
  26. }
  27. else{
  28. if(cellState.equals(BinaryState.ALIVE)){
  29. ant.antState=AntState.WEST;
  30. }
  31. else{
  32. ant.antState=AntState.EAST;
  33. }
  34. }
  35. }
  36. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement