Examples of ScoreContext


Examples of com.jcloisterzone.feature.visitor.score.ScoreContext

        return rating;
    }

    private ScoreContext futureConnectionCreateScoreContext(Game game, Feature feature) {
        LegacyAiScoreAllCallback ctxHelper = new LegacyAiScoreAllCallback(game);
        ScoreContext ctx;
        if (feature instanceof Completable) {
            ctx = ctxHelper.getCompletableScoreContext((Completable) feature);
        } else {
            ctx = ctxHelper.getFarmScoreContext((Farm) feature);
            ((LegacyAiFarmScoreContext) ctx).setCityCache(new HashMap<City, CityScoreContext>());
View Full Code Here

Examples of com.jcloisterzone.feature.visitor.score.ScoreContext

        }
        return rating;
    }

    private double futureConnectionRateCrossing(Game game, Location toEmpty, Location toFeature, double chance, Feature f1, Feature f2) {
        ScoreContext f1Ctx = futureConnectionCreateScoreContext(game, f1);
        ScoreContext f2Ctx = futureConnectionCreateScoreContext(game, f2);
        Map<Player, Integer> f1Powers = f1Ctx.getPowers();
        Map<Player, Integer> f2Powers = f2Ctx.getPowers();

        int[] powers = funtureConnectionSumPower(f2Powers, null);
        int myPower = powers[0];
        int bestEnemy = powers[1];
View Full Code Here

Examples of com.jcloisterzone.feature.visitor.score.ScoreContext

        return 0;
    }


    private double futureConnectionRateFeatures(Game game, Location toEmpty, Location toFeature, double chance, Feature f1, Feature f2) {
        ScoreContext f1Ctx = futureConnectionCreateScoreContext(game, f1);
        ScoreContext f2Ctx = futureConnectionCreateScoreContext(game, f2);
        Map<Player, Integer> f1Powers = f1Ctx.getPowers();
        Map<Player, Integer> f2Powers = f2Ctx.getPowers();

        if (f1Powers.size() == 0) {
            return 0;
        }
View Full Code Here

Examples of com.music.ScoreContext

    private Joiner joiner = Joiner.on(",");

    @Transactional
    public long generatePiece() {
        long start = System.currentTimeMillis();
        ScoreContext ctx = generator.generatePiece();
        logger.info("Piece generation took: " + (System.currentTimeMillis() - start) + " millis");
        byte[] mp3 = null;
        byte[] midi = null;
        try {
            ByteArrayOutputStream baos = new ByteArrayOutputStream();
            try {
                start = System.currentTimeMillis();
                MutingPrintStream.ignore.set(true);
                Write.midi(ctx.getScore(), baos);
                logger.info("Writing MIDI in memory took: " + (System.currentTimeMillis() - start) + " millis");
            } finally {
                MutingPrintStream.ignore.set(null);
            }
            midi = baos.toByteArray();
View Full Code Here

Examples of com.music.ScoreContext

        private static void playMelody(SourceDataLine line, Double[] scaleFrequencies) {
            int position;
            MainPartContext lCtx = new MainPartContext();
            lCtx.setDirectionUp(true);
            ScoreContext ctx = new ScoreContext();
            double[] melody = new double[30];
            double[] lengths = new double[30];
            for (int i = 0; i < 30; i++) {
                position = getNextNotePitchIndex(ctx, lCtx, scaleFrequencies);
                double freq = scaleFrequencies[position];
View Full Code Here

Examples of com.music.ScoreContext

        MainPartGenerator generator = new MainPartGenerator();
        Score score = new Score();
        Part mainPart = new Part("Main", 1);
        score.addPart(mainPart);
        ScoreContext ctx = new ScoreContext();
        ctx.setMetre(new int[] {3, 8});
        ctx.setScale(Scale.MINOR);
        ctx.setKeyNote(5);
        ctx.setNoteLengthCoefficient(1);
        double normalizedMeasureSize = 1d * ctx.getMetre()[0] * 4 / ctx.getMetre()[1];
        ctx.setNormalizedMeasureSize(normalizedMeasureSize);
        MainPartContext lCtx = generator.initLocalContext(score, ctx);
        lCtx.setPitches(Arrays.asList(60, 80, 80));
        ExtendedPhrase p = new ExtendedPhrase();
        p.setBaseVelocity(40);
        p.setScale(ctx.getScale());
        mainPart.add(p);
        lCtx.setCurrentPhrase(p);
        for (Note note : melody) {
            p.addNote(note);
        }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.