public void loadObstacles(String fileName) throws IOException {
        list = new LinkedList();
        try {
            float x1, x2, x3;
            float y1, y2, y3;
            float r;
            BufferedReader in = new BufferedReader(new FileReader(fileName));
            while (in.ready()) {
                String line = in.readLine();
                StringTokenizer str = new StringTokenizer(line, " ");
                int type = Integer.parseInt(str.nextToken());
                switch (type) {
                    case 0: // Square
                        x1 = Float.parseFloat(str.nextToken());
                        y1 = Float.parseFloat(str.nextToken());
                        x2 = Float.parseFloat(str.nextToken());
                        y2 = Float.parseFloat(str.nextToken());
                        list.add(new Square(x1, y1, x2, y2));
                        break;
                    case 1: // Circle
                        x1 = Float.parseFloat(str.nextToken());
                        y1 = Float.parseFloat(str.nextToken());
                        r = Float.parseFloat(str.nextToken());
                        list.add(new Circle(x1, y1, r));
                        break;
                    case 2: // Triangle
                        x1 = Float.parseFloat(str.nextToken());
                        y1 = Float.parseFloat(str.nextToken());
                        x2 = Float.parseFloat(str.nextToken());
                        y2 = Float.parseFloat(str.nextToken());
                        x3 = Float.parseFloat(str.nextToken());
                        y3 = Float.parseFloat(str.nextToken());
                        list.add(new Triangle(x1, y1, x2, y2, x3, y3));
                        break;
                }
            }
        } catch (IOException e) {
            list = new LinkedList();
            throw e;
        }
    }