Advertisement
Guest User

Untitled

a guest
Sep 25th, 2017
59
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.65 KB | None | 0 0
  1. public static Vector<int[]> getStates(int[] actual)
  2. {
  3. Vector<int[]> states = new Vector<int[]>();
  4. int temp[] = new int[4];
  5.  
  6.  
  7. if(actual[0] == 1)
  8. actual[0] = 0;
  9. else
  10. actual[0] = 1;
  11.  
  12. temp = actual;
  13.  
  14. //printArray(actual);
  15. printArray(temp);
  16. states.add(temp);
  17.  
  18.  
  19. for(int i = 1 ; i < 4 ; i++)
  20. {
  21. if(actual[0] == 1)
  22. {
  23. if(actual[i] == 0)
  24. {
  25. temp[i] = 1;
  26. }
  27. }else{
  28. if(actual[i] == 1)
  29. {
  30. temp[i] = 0;
  31. }
  32. }
  33.  
  34. states.add(temp);
  35. printArray(temp);
  36.  
  37. if(actual[i] == 1)
  38. temp[i] = 0;
  39. else
  40. temp[i] = 1;
  41.  
  42. }
  43. return states;
  44. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement