public Pair<Node, Edge> placeInitialSettlements(boolean first) {
        List<Node> l = new ArrayList<Node>();
        for (Node i : Board.allNodes())
            if (api.canBuildSettlementAt(i, false))
                l.add(i);

        Collections.sort(l, new Comparator<Node>() {
            private int sum(Node a) {
                int ans = 0;
                for (Hex c : Board.adjacentHexes(a)) {
                    int x = api.board().numberAt(c);
                    ans += Math.max(6 - Math.abs(x - 7), 0);
                }
                return ans;
            }
            public int compare(Node a, Node b) {
                int sa = sum(a), sb = sum(b);
                if (sa < sb) return 1;
                if (sa > sb) return -1;
                boolean pa = api.board().harborAt(a) != null;
                boolean pb = api.board().harborAt(b) != null;
                if (!pa && pb) return 1;
                if (pa && !pb) return -1;
                return 0;
            }
        });

        Node i = l.get(0);
        List<Edge> edges = Board.adjacentEdges(i);
        int edgeno = rnd.nextInt(edges.size());
        return Pair.make(i, edges.get(edgeno));
    }