package ego.gomuku.core;

import ego.gomuku.entity.Point;

import java.util.ArrayList;
import java.util.List;

class LevelProcessor {

    static List<Point> getExpandPoints(Analyzer data) {
        List<Point> result = selectSet(data);

        if (result.isEmpty()) {
            result.add(new Point(7, 7));
            return result;
        }

        return result;
    }

    private static List<Point> selectSet(Analyzer data) {
        //如果能连5，则连5
        if (!data.getFiveAttack().isEmpty()) {
            return new ArrayList<>(data.getFiveAttack());
        }
        //如果有对方冲4，则防冲4
        if (!data.getFourDefence().isEmpty()) {
            return new ArrayList<>(data.getFourDefence());
        }
        //如果有对方活3，则防活3或者冲四
        if (!data.getThreeDefence().isEmpty()) {
            return new ArrayList<Point>(data.getFourAttack()) {{
                addAll(data.getThreeDefence());
            }};
        }
        List<Point> result = new ArrayList<>();
        result.addAll(data.getFourAttack());
        result.addAll(data.getThreeOpenAttack());
        result.addAll(data.getTwoAttack());
        result.addAll(data.getNotKey());
        return result;
    }
}

@@ -1143,24 +1143,139 @@
 etNotKey());
+%0A%0A        //%E5%A6%82%E6%9E%9C%E8%8A%82%E7%82%B9%E8%BF%87%E5%A4%9A%E5%88%99%E5%87%8F%E5%B0%91%E4%B8%80%E9%83%A8%E5%88%86%0A        while (result.size() %3E 40) %7B%0A            result = result.subList(0, 40);%0A        %7D
 %0A        ret

cut some point