1. beholdmyglory
  2. REMAINS

Commits

John Eriksson  committed 7789ed8

Fixed addCell

  • Participants
  • Parent commits 5335862
  • Branches default

Comments (0)

Files changed (1)

File src/se/kth/csc/inda11/remains/simulator/Simulator.java

View file
         if (running) {
             throw new IllegalStateException();
         }
+        Point p = new Point(x, y);
+        removeCell(x, y);
+        
 
-        Set<Point> set;
+
         if (type == Cell.CONDUCTOR) {
-            set = conductors;
+            conductors.add(p);
         } else if (type == Cell.HEAD) {
-            set = heads;
-        } else {
-            set = tails;
-        }
-        set.add(new Point(x, y));
+            heads.add(p);
+        } else if(type == Cell.TAIL) {
+            tails.add(p);
+        } // else type == Cell.EMPTY, ignore
+        
     }
 
     /**