public static void dump(Logic logic, SparseMatrix<Block> grid) {
   System.out.println(
       "Logic, unknown="
           + logic.getUnknown1()
           + ", #controllers="
           + logic.getControllers().size());
   for (ControllerEntry controller : logic.getControllers()) {
     Block controllerBlock = grid.get(controller.getPosition());
     System.out.println(
         "  Controller at "
             + controller.getPosition()
             + " ("
             + BlockTypes.BLOCK_NAMES.get(controllerBlock.getBlockID())
             + "), #groups="
             + controller.getGroups().size());
     for (GroupEntry group : controller.getGroups()) {
       System.out.println(
           "    Group of "
               + group.getBlocks().size()
               + " "
               + BlockTypes.BLOCK_NAMES.get(group.getBlockID()));
       //                for (Point3s block : group.getBlocks())
       //                {
       //                    Block groupBlock = grid.get(block);
       //                    System.out.println("      "+block+"
       // ("+BlockTypes.BLOCK_NAMES.get(groupBlock.getBlockID())+")");
       //                }
     }
   }
 }
 public static void writeFile(Logic logic, OutputStream os, boolean close) throws IOException {
   DataOutputStream dos;
   if (os instanceof DataOutputStream) dos = (DataOutputStream) os;
   else dos = new DataOutputStream(os);
   dos.writeInt(logic.getUnknown1());
   dos.writeInt(logic.getControllers().size());
   for (ControllerEntry controller : logic.getControllers()) {
     IOLogic.writePoint3s(dos, controller.getPosition());
     dos.writeInt(controller.getGroups().size());
     for (GroupEntry group : controller.getGroups()) {
       dos.writeShort(group.getBlockID());
       dos.writeInt(group.getBlocks().size());
       for (Point3s block : group.getBlocks()) IOLogic.writePoint3s(dos, block);
     }
   }
   if (close) dos.close();
 }