This editor example shows how to interact with holodeck worlds while they are being built
    in the Unreal Engine. Most people that use holodeck will not need this.
192797
def editor_example():
    
    sensors = [Sensors.PIXEL_CAMERA, Sensors.LOCATION_SENSOR, Sensors.VELOCITY_SENSOR]
    agent = AgentDefinition("uav0", agents.UavAgent, sensors)
    env = HolodeckEnvironment(agent, start_world=False)
    env.agents["uav0"].set_control_scheme(1)
    command = [0, 0, 10, 50]

    for i in range(10):
        env.reset()
        for _ in range(1000):
            state, reward, terminal, _ = env.step(command)
438200
public static void main(String[] argv) {
		try {
			// create a new container for our example game. This container
			// just creates a normal native window for rendering OpenGL accelerated
			// elements to
			AppGameContainer container = new AppGameContainer(new Scroller(), 800, 600, false);
			container.start();
		} catch (Exception e) {
			e.printStackTrace();
		}
	}
521351
def _render_round_init(self, horizon: int, non_fluents: NonFluents) -> None:
        ''''''
        print('*********************************************************')
        print('>>> ROUND INIT, horizon = {}'.format(horizon))
        print('*********************************************************')
        fluent_variables = self._compiler.rddl.non_fluent_variables
        self._render_fluent_timestep('non-fluents', non_fluents, fluent_variables)
698195
function ParticleSystem(name, capacity, scene, customEffect, _isAnimationSheetEnabled, epsilon) {
            if (_isAnimationSheetEnabled === void 0) { _isAnimationSheetEnabled = false; }
            if (epsilon === void 0) { epsilon = 0.01; }
            var _this = this;
            this.name = name;
            this._isAnimationSheetEnabled = _isAnimationSheetEnabled;
            // Members
            this.animations = [];
            this.renderingGroupId = 0;
            this.emitter = null;
            this.emitRate = 10;
            this.manualEmitCount = -1;
            this.updateSpeed = 0.01;
            this.targetStopDuration = 0;
            this.disposeOnStop = false;
            this.minEmitPower = 1;
            this.maxEmitPower = 1;
            this.minLifeTime = 1;
            this.maxLifeTime = 1;
            this.minSize = 1;
            this.maxSize = 1;
            this.minAngularSpeed = 0;
            this.maxAngularSpeed = 0;
            this.layerMask = 0x0FFFFFFF;
            this.customShader = null;
            this.preventAutoStart = false;
            /**
            * An event triggered when the system is disposed.
            * @type {BABYLON.Observable}
            */
            this.onDisposeObservable = new BABYLON.Observable();
            this.onAnimationEnd = null;
            this.blendMode = ParticleSystem.BLENDMODE_ONEONE;
            this.forceDepthWrite = false;
            this.gravity = BABYLON.Vector3.Zero();
            this.direction1 = new BABYLON.Vector3(0, 1.0, 0);
            this.direction2 = new BABYLON.Vector3(0, 1.0, 0);
            this.minEmitBox = new BABYLON.Vector3(-0.5, -0.5, -0.5);
            this.maxEmitBox = new BABYLON.Vector3(0.5, 0.5, 0.5);
            this.color1 = new BABYLON.Color4(1.0, 1.0, 1.0, 1.0);
            this.color2 = new BABYLON.Color4(1.0, 1.0, 1.0, 1.0);
            this.colorDead = new BABYLON.Color4(0, 0, 0, 1.0);
            this.textureMask = new BABYLON.Color4(1.0, 1.0, 1.0, 1.0);
            this.particles = new Array();
            this._stockParticles = new Array();
            this._newPartsExcess = 0;
            this._vertexBuffers = {};
            this._scaledColorStep = new BABYLON.Color4(0, 0, 0, 0);
            this._colorDiff = new BABYLON.Color4(0, 0, 0, 0);
            this._scaledDirection = BABYLON.Vector3.Zero();
            this._scaledGravity = BABYLON.Vector3.Zero();
            this._currentRenderId = -1;
            this._started = false;
            this._stopped = false;
            this._actualFrame = 0;
            // sheet animation
            this.startSpriteCellID = 0;
            this.endSpriteCellID = 0;
            this.spriteCellLoop = true;
            this.spriteCellChangeSpeed = 0;
            this.spriteCellWidth = 0;
            this.spriteCellHeight = 0;
            this._vertexBufferSize = 11;
            this.appendParticleVertexes = null;
            this.id = name;
            this._capacity = capacity;
            this._epsilon = epsilon;
            if (_isAnimationSheetEnabled) {
                this._vertexBufferSize = 12;
            }
            this._scene = scene || BABYLON.Engine.LastCreatedScene;
            this._customEffect = customEffect;
            scene.particleSystems.push(this);
            this._createIndexBuffer();
            // 11 floats per particle (x, y, z, r, g, b, a, angle, size, offsetX, offsetY) + 1 filler
            this._vertexData = new Float32Array(capacity * this._vertexBufferSize * 4);
            this._vertexBuffer = new BABYLON.Buffer(scene.getEngine(), this._vertexData, true, this._vertexBufferSize);
            var positions = this._vertexBuffer.createVertexBuffer(BABYLON.VertexBuffer.PositionKind, 0, 3);
            var colors = this._vertexBuffer.createVertexBuffer(BABYLON.VertexBuffer.ColorKind, 3, 4);
            var options = this._vertexBuffer.createVertexBuffer("options", 7, 4);
            if (this._isAnimationSheetEnabled) {
                var cellIndexBuffer = this._vertexBuffer.createVertexBuffer("cellIndex", 11, 1);
                this._vertexBuffers["cellIndex"] = cellIndexBuffer;
            }
            this._vertexBuffers[BABYLON.VertexBuffer.PositionKind] = positions;
            this._vertexBuffers[BABYLON.VertexBuffer.ColorKind] = colors;
            this._vertexBuffers["options"] = options;
            // Default behaviors
            this.startDirectionFunction = function (emitPower, worldMatrix, directionToUpdate, particle) {
                var randX = randomNumber(_this.direction1.x, _this.direction2.x);
                var randY = randomNumber(_this.direction1.y, _this.direction2.y);
                var randZ = randomNumber(_this.direction1.z, _this.direction2.z);
                BABYLON.Vector3.TransformNormalFromFloatsToRef(randX * emitPower, randY * emitPower, randZ * emitPower, worldMatrix, directionToUpdate);
            };
            this.startPositionFunction = function (worldMatrix, positionToUpdate, particle) {
                var randX = randomNumber(_this.minEmitBox.x, _this.maxEmitBox.x);
                var randY = randomNumber(_this.minEmitBox.y, _this.maxEmitBox.y);
                var randZ = randomNumber(_this.minEmitBox.z, _this.maxEmitBox.z);
                BABYLON.Vector3.TransformCoordinatesFromFloatsToRef(randX, randY, randZ, worldMatrix, positionToUpdate);
            };
            this.updateFunction = function (particles) {
                for (var index = 0; index < particles.length; index++) {
                    var particle = particles[index];
                    particle.age += _this._scaledUpdateSpeed;
                    if (particle.age >= particle.lifeTime) {
                        _this.recycleParticle(particle);
                        index--;
                        continue;
                    }
                    else {
                        particle.colorStep.scaleToRef(_this._scaledUpdateSpeed, _this._scaledColorStep);
                        particle.color.addInPlace(_this._scaledColorStep);
                        if (particle.color.a < 0)
                            particle.color.a = 0;
                        particle.angle += particle.angularSpeed * _this._scaledUpdateSpeed;
                        particle.direction.scaleToRef(_this._scaledUpdateSpeed, _this._scaledDirection);
                        particle.position.addInPlace(_this._scaledDirection);
                        _this.gravity.scaleToRef(_this._scaledUpdateSpeed, _this._scaledGravity);
                        particle.direction.addInPlace(_this._scaledGravity);
                        if (_this._isAnimationSheetEnabled) {
                            particle.updateCellIndex(_this._scaledUpdateSpeed);
                        }
                    }
                }
            };
        }
295544
function createEngine(options = {}) {
    const isManaged = argv.GamePort || argv.StartPort || argv.LadderServer;

    const opts = {
        port: 5000,
        host : '127.0.0.1',
        launch: true,
        ...options,
    };

    // the ladder manager is launching this agent and it should override anything else
    if (isManaged) {
        opts.port = argv.GamePort;
        opts.host = argv.LadderServer;
    }
    
    opts.onGameEnd = opts.onGameEnd || NOOP;

    const world = World();
    const { actions: { _client } } = world.resources.get();

    /** @type {Engine} */
    const engine = {
        _totalLoopDelay: 0,
        _gameLeft: false,
        launcher,
        use(sys) {
            if (Array.isArray(sys)) {
                sys.forEach(s => this.systems.push(s));
            } else {
                this.systems.push(sys);
            }
        },
        systems: [],
        async connect() {
            if (opts.launch && !isManaged) {
                await launcher(opts);
            }

            const pingRes = await _client.connect(opts);

            /** 
             * @TODO: @node-sc2/proto should be throwing a custom error type here so we
             * can safely expect what the error shape is -
             */

            _client._ws.on('error', (e) => {
                // @ts-ignore
                debugEngine('Received error from transport layer:', e);
            });

            _client._ws.on('leftGame', () => {
                this._gameLeft = true;
            });

            return pingRes;
        },
        async runGame(map = '', players = []) {
            const player = players.find(p => !!p.agent);
            player.agent.settings.race = player.race;

            await this.createGame(map, players);
            return this.joinGame(player.agent);
        },
        async createGame(map = '', playerSetup = [], realtime = false) {
            if (isManaged) {
                debugEngine(`Engine tried to create a game, but is being managed by a ladder manager - skipping...`);
                return;
            }

            if (_client.status !== 1 && _client.status !== 5) {
                console.warn(`cannot create a game unless in "launched" or "ended" status, current status is ${StatusId[_client.status]}`);
                return;
            }

            let mapPath, battlenetMapName;

            if (map.includes('SC2Map')) {
                mapPath = map;
            } else {
                try {
                    mapPath = await findMap(map);
                } catch (e) {
                    battlenetMapName = map;
                }
            }

            /** @type {SC2APIProtocol.RequestCreateGame} */
            const game = {
                realtime,
                playerSetup,
            };

            if (mapPath) {
                game.localMap = { mapPath };
            } else {
                game.battlenetMapName = battlenetMapName;
            }

            // @FIXME: battlenet map cache sort of is broken

            debugEngine('CREATE GAME REQUEST: ', game);

            return _client.createGame(game);
        },
        async joinGame(agent, options = {}) {
            world.agent = agent;
            
            if (!agent.interface.raw) {
                throw new Error('`raw` is currently the only interface supported by this engine.');
            }

            switch (_client.status) {
                case 1:
                case 2: {
                    /** @type {SC2APIProtocol.RequestJoinGame} */
                    let participant = {
                        race: agent.settings && agent.settings.race || Race.RANDOM,
                        options: agent.interface,
                        ...options
                    };

                    if (isManaged) {
                        let sPort = /** @type {number} */ argv.StartPort + 1;

                        participant = {
                            ...participant,
                            sharedPort: sPort++,
                            serverPorts: {
                                gamePort: sPort++, 
                                basePort: sPort++,
                            },
                            clientPorts: [{
                                gamePort: sPort++,
                                basePort: sPort++,
                            }, {
                                gamePort: sPort++,
                                basePort: sPort++,
                            }]
                        };
                    }

                    // join the game and subsequently set the playerId for the bot
                    const joinGame = await _client.joinGame(participant);
                    debugEngine('JOIN GAME RES: ', joinGame);

                    agent.playerId = joinGame.playerId;

                    return this.firstRun();
                }

                case 3: {
                    console.warn(`cannot join lobby for a game already in progress, attemping to resync to existing game...`);

                    /* @FIXME how do we actually negotiate our player id here for resyncing? assuming 1 for debugging... */
                    agent.playerId = 1;

                    return this.firstRun();
                }

                default: {
                    throw new Error(`cannot join a game this engine didn't create unless in "launched" status, current status is ${StatusId[_client.status]}`);
                }

            }
        },
        async firstRun() {
            const { data, resources, agent } = world;

            /** @type {SC2APIProtocol.ResponseData} */
            const gameData = await _client.data({
                abilityId: true,
                unitTypeId: true,
                upgradeId: true,
                buffId: true,
                effectId: true,
            });

            ['abilities', 'units', 'upgrades', 'buffs', 'effects'].forEach((dataType) => {
                if (gameData[dataType]) data.set(dataType, gameData[dataType]);
            });

            [...this.systems, ...agent.systems, agent, debugSystem].forEach(system => system.setup(world));

            const { events } = resources.get();

            events.write({
                name: 'gameStart',
                type: 'all',
            });

            await this.dispatch();
            return this.runLoop();
        },
        onGameEnd(results) {
            if (!results || results.length <= 0) {
                console.warn('The game ended but there is no result data');
            }
            debugEngine(`Average step delay for this game: ${this._totalLoopDelay / world.resources.get().frame.getGameLoop()}`);
            // @TODO: have some option to configure auto-saving of replays
            return [world, results];
        },
        async runLoop() {
            const { events, frame } = world.resources.get();

            if (_client.status !== 3) {
                debugEngine('exiting loop, status no longer in game');
                this.onGameEnd(frame._result);
                // @TODO: check the frame to see if there happens to be some result data?
                throw new GameEndedError('Status no longer in game');
            }

            if (this._lastRequest) {
                this._loopDelay = hrtimeH(process.hrtime(this._lastRequest)).milliseconds;

                /** 
                 * I'd like to keep this here. I think as long as this api is aligned to providing a framework
                 * to get bots onto a ladder (like sc2ai, etc) or into tournaments - the user shouldn't be able
                 * to make a slow, resource draining bot without it being shoved in their face.
                 * 
                 * @TODO: maybe allow this to be configurable? not off... per se, but some threshhold.
                 */
                if (this._loopDelay / STEP_COUNT > 44.6) {
                    // console.warn(`WARNING! loop delay is ${this._loopDelay / STEP_COUNT}ms, greater than realtime`);
                }

                this._totalLoopDelay += this._loopDelay / STEP_COUNT;

                /**
                 * this was here for testing, but we could use it in the future to implement realtime
                 * 
                 * this.loopDelay = hrtimeH(process.hrtime(this.lastRequest)).milliseconds;
                 * const shouldDelay = calculateDelay(this.loopDelay);
                 * debug('delay frame: ', shouldDelay);
                 * //@ts-ignore bogus export default typing issue with `delay` package
                 * await delay(shouldDelay || 0);
                 */
            }

            this._lastRequest = process.hrtime();

            if (process.env.DELAY) {
                await Promise.delay(parseInt(process.env.DELAY, 10));
            }

            await _client.step({ count: STEP_COUNT });

            events.write({
                name: 'step',
                type: 'all',
                data: frame.getGameLoop() + STEP_COUNT,
            });

            try {
                await this.dispatch();
            } catch(e) {
                // @FIXME: this really shouldn't be branched via an error... but it was a quick fix
                if (e instanceof GameEndedError) {
                    // game over dude, we outtie
                    return this.onGameEnd(e.data);
                } else {
                    console.warn('An error of an unknown type has propegated up to the game loop', e);
                    throw e;
                }
            }

            return this.runLoop();
        },
        async dispatch() {
            /**
             * First, run all engine systems, and in series - the 'step' event propegates
             * all other events as well - starting with the frame system that handles digesting
             * the updated frame data.
             */
            const engineSystems = this.systems;
            await Promise.mapSeries(engineSystems, system => system(world)); // concurrency: 1
            
            /**
             * Next let the agent itself consume events -
             * 
             * @FIXME: this is a lot of duplicated logic from the system wrapper...
             * maybe an agent itself should just be a glorified system? alternative
             * is that it's time to break the dispatcher out into an actual entity
             * instead of just this engine function.
             */ 

            const { agent, resources } = world;
            const { events } = resources.get();
            const eventsWithHandlers = events.read(agent.readerId).filter(event => agent[`on${pascalCase(event.name)}`]);
            const handlerPromises = eventsWithHandlers.length > 0 ?
                eventsWithHandlers.map((event) => {
                    return agent[`on${pascalCase(event.name)}`](world, event.data, event)
                        .catch((err) => {
                            if (err instanceof NodeSC2Error) {
                                debugSilly(`Agent handler error: on${pascalCase(event.name)}: `, err);
                            } else {
                                console.warn(`Agent handler error: on${pascalCase(event.name)}: `);
                                debugEngine(err.message);
                                debugEngine(err.stack);
                            }
                        });
                }) :
                [];

            await Promise.all(handlerPromises);

            /**
             * @TODO: Should agent systems always be run concurrently? 
             * 
             * i fear making this configurable because it could cause massive 
             * perf issues with a ton of systems all potentially awaiting transport.
             * On the other hand - it would create a huge amount of flexibility to
             * allow systems to define their other system dependencies... such as acting
             * on entities with certain labels after they have been assigned/removed
             * by other systems that frame.
             */
            const { agent: { systems } } = world;
            await Promise.map(systems, system => system(world));

            // debug system runs last because it updates the in-client debug display
            return debugSystem(world);
        },
        _lastRequest: null,
    };

    engine.use([
        frameSystem,
        unitSystem,
        mapSystem,
    ]);

    return engine;
}
387994
@SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {
        java.awt.GridBagConstraints gridBagConstraints;

        imagePanel = new javax.swing.JPanel();
        imageSplitPane = new javax.swing.JSplitPane();
        origImagePanel = new javax.swing.JPanel();
        polygonImagePanel = new javax.swing.JPanel();
        buttonPanel = new javax.swing.JPanel();
        startButton = new javax.swing.JButton();
        stopButton = new javax.swing.JButton();
        openButton = new javax.swing.JButton();
        pauseButton = new javax.swing.JButton();
        saveButton = new javax.swing.JButton();
        resultPanel = new javax.swing.JPanel();
        bestEvolutionResultPanel = new io.jenetics.example.image.EvolutionResultPanel();
        currentevolutionResultPanel = new io.jenetics.example.image.EvolutionResultPanel();
        engineParamPanel = new io.jenetics.example.image.EngineParamPanel();

        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
        setTitle("Evolving images");

        imagePanel.setBackground(new java.awt.Color(153, 153, 153));
        imagePanel.setLayout(new java.awt.GridLayout(1, 1));

        imageSplitPane.setDividerLocation(300);

        origImagePanel.setBorder(javax.swing.BorderFactory.createTitledBorder("Source image"));
        origImagePanel.setName(""); // NOI18N
        origImagePanel.addComponentListener(new java.awt.event.ComponentAdapter() {
            public void componentResized(java.awt.event.ComponentEvent evt) {
                origImagePanelComponentResized(evt);
            }
        });
        origImagePanel.setLayout(new java.awt.BorderLayout());
        imageSplitPane.setLeftComponent(origImagePanel);

        polygonImagePanel.setBorder(javax.swing.BorderFactory.createTitledBorder("Polygon image"));
        polygonImagePanel.setLayout(new java.awt.GridLayout(1, 1));
        imageSplitPane.setRightComponent(polygonImagePanel);

        imagePanel.add(imageSplitPane);

        startButton.setText("Start");
        startButton.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                startButtonActionPerformed(evt);
            }
        });

        stopButton.setText("Stop");
        stopButton.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                stopButtonActionPerformed(evt);
            }
        });

        openButton.setText("Open");
        openButton.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                openButtonActionPerformed(evt);
            }
        });

        pauseButton.setText("Pause");
        pauseButton.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                pauseButtonActionPerformed(evt);
            }
        });

        saveButton.setText("Save");
        saveButton.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                saveButtonActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout buttonPanelLayout = new javax.swing.GroupLayout(buttonPanel);
        buttonPanel.setLayout(buttonPanelLayout);
        buttonPanelLayout.setHorizontalGroup(
            buttonPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(buttonPanelLayout.createSequentialGroup()
                .addContainerGap()
                .addGroup(buttonPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(startButton, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(stopButton, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(openButton, javax.swing.GroupLayout.DEFAULT_SIZE, 119, Short.MAX_VALUE)
                    .addComponent(pauseButton, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(saveButton, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                .addContainerGap())
        );
        buttonPanelLayout.setVerticalGroup(
            buttonPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(buttonPanelLayout.createSequentialGroup()
                .addContainerGap()
                .addComponent(startButton)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(stopButton)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(pauseButton)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 196, Short.MAX_VALUE)
                .addComponent(openButton)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(saveButton)
                .addContainerGap())
        );

        resultPanel.setLayout(new java.awt.GridBagLayout());

        bestEvolutionResultPanel.setBorder(javax.swing.BorderFactory.createTitledBorder("Best"));
        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.gridx = 1;
        gridBagConstraints.gridy = 0;
        gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
        gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
        gridBagConstraints.weightx = 1.0;
        gridBagConstraints.insets = new java.awt.Insets(2, 2, 2, 2);
        resultPanel.add(bestEvolutionResultPanel, gridBagConstraints);

        currentevolutionResultPanel.setBorder(javax.swing.BorderFactory.createTitledBorder("Current"));
        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.gridx = 0;
        gridBagConstraints.gridy = 0;
        gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
        gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
        gridBagConstraints.weightx = 1.0;
        resultPanel.add(currentevolutionResultPanel, gridBagConstraints);

        engineParamPanel.setBorder(javax.swing.BorderFactory.createTitledBorder("Engine parameter"));
        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.gridx = 0;
        gridBagConstraints.gridy = 1;
        gridBagConstraints.gridwidth = 2;
        gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
        resultPanel.add(engineParamPanel, gridBagConstraints);

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(resultPanel, javax.swing.GroupLayout.DEFAULT_SIZE, 788, Short.MAX_VALUE)
                    .addGroup(layout.createSequentialGroup()
                        .addComponent(imagePanel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addComponent(buttonPanel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
                .addContainerGap())
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(buttonPanel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(imagePanel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(resultPanel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap())
        );

        pack();
    }
762272
function Renderer(opts) {
  this.entities = []
  this.root = this.entity()

  // check if we passed gl context or options object
  opts = opts.texture2D ? { ctx: opts } : opts

  const ctx = (this._ctx = opts.ctx)

  const gl = opts.ctx.gl
  gl.getExtension('OES_standard_derivatives')

  this._dummyTexture2D = ctx.texture2D({ width: 4, height: 4 })
  this._dummyTextureCube = ctx.textureCube({ width: 4, height: 4 })

  this._debug = false
  this._programCacheMap = {
    values: [],
    getValue: function(flags, vert, frag) {
      for (var i = 0; i < this.values.length; i++) {
        var v = this.values[i]
        if (v.frag === frag && v.vert === vert) {
          if (v.flags.length === flags.length) {
            var found = true
            for (var j = 0; j < flags.length; j++) {
              if (v.flags[j] !== flags[j]) {
                found = false
                break
              }
            }
            if (found) {
              return v.program
            }
          }
        }
      }
      return false
    },
    setValue: function(flags, vert, frag, program) {
      this.values.push({ flags, vert, frag, program })
    }
  }

  if (opts.profile) {
    State.profiler = createProfiler(opts.ctx, this)
    State.profiler.flush = opts.profileFlush
  }

  if (opts.pauseOnBlur && isBrowser) {
    window.addEventListener('focus', () => {
      State.paused = false
    })
    window.addEventListener('blur', () => {
      State.paused = true
    })
  }

  // TODO: move from State object to internal probs and renderer({ opts }) setter?
  Object.assign(State, opts)
  this._state = State

  this.shaders = {
    chunks: SHADERS_CHUNKS,
    pipeline: {
      material: {
        vert: PBR_VERT,
        frag: PBR_FRAG
      }
    }
  }
}
164008
@Override
    public void init(Controller c) {
        super.init(c);
        ShanksSimulation sim = (ShanksSimulation) state;

        Display3D mainDisplay = new Display3D(800, 800, this);
        mainDisplay.setBackdrop(Color.white);
        try {
            Scenario3DPortrayal scenarioPortrayal = (Scenario3DPortrayal) this
                    .getSimulation().getScenarioPortrayal();

            HashMap<String, Display3D> displays = scenarioPortrayal
                    .getDisplays();
            ContinuousPortrayal3D devicesPortrayal;
            devicesPortrayal = (ContinuousPortrayal3D) sim
                    .getScenarioPortrayal().getPortrayals()
                    .get(Scenario3DPortrayal.MAIN_DISPLAY_ID)
                    .get(ScenarioPortrayal.DEVICES_PORTRAYAL);
            Continuous3D devicesGrid = (Continuous3D) devicesPortrayal
                    .getField();
            mainDisplay.scale(0.08 / devicesGrid.getHeight());
            mainDisplay.setShowsAxes(true);
            scenarioPortrayal.addDisplay(Scenario3DPortrayal.MAIN_DISPLAY_ID,
                    mainDisplay);

            this.addDisplays(scenarioPortrayal);
            this.addCharts(scenarioPortrayal);

            HashMap<String, TimeSeriesChartGenerator> timeCharts = scenarioPortrayal
                    .getTimeCharts();

            for (Entry<String, Display3D> displayEntry : displays.entrySet()) {
                JFrame frame = displayEntry.getValue().createFrame();
                scenarioPortrayal.addFrame(displayEntry.getKey(), frame);
                frame.setTitle(displayEntry.getKey());
                c.registerFrame(frame);
                frame.setVisible(true);
                displayEntry.getValue().getSelectionBehavior()
                        .setTolerance(10.0f);
            }

            for (Entry<String, TimeSeriesChartGenerator> chartEntry : timeCharts
                    .entrySet()) {
                JFrame frame = chartEntry.getValue().createFrame();
                scenarioPortrayal.addFrame(chartEntry.getKey(), frame);
                frame.setTitle(chartEntry.getKey());
                c.registerFrame(frame);
                frame.setVisible(true);
            }

            this.locateFrames(scenarioPortrayal);

            // } catch (DuplictaedDisplayIDException e) {
            // logger.severe(e.getMessage());
            // e.printStackTrace();
            // } catch (DuplicatedPortrayalIDException e) {
            // logger.severe(e.getMessage());
            // e.printStackTrace();
            // } catch (ScenarioNotFoundException e) {
            // logger.severe(e.getMessage());
            // e.printStackTrace();
            // } catch (DuplictedFrameIDException e) {
            // e.printStackTrace();
            // } catch (DuplicatedChartIDException e) {
            // e.printStackTrace();
        } catch (ShanksException e) {
            logger.severe(e.getMessage());
            e.printStackTrace();
        }
    }
524376
function draw(renderer, container) {
         var translateX = this.pos.x + this.offset.x;
         var translateY = this.pos.y + this.offset.y; // translate the world coordinates by default to screen coordinates

         container.currentTransform.translate(-translateX, -translateY); // clip to camera bounds

         renderer.clipRect(0, 0, this.width, this.height);
         this.preDraw(renderer);
         container.preDraw(renderer); // draw all objects,
         // specifying the viewport as the rectangle area to redraw

         container.draw(renderer, this); // draw the viewport/camera effects

         this.drawFX(renderer);
         container.postDraw(renderer);
         this.postDraw(renderer); // translate the world coordinates by default to screen coordinates

         container.currentTransform.translate(translateX, translateY);
       }
513402
function (subMesh) {
                var mesh = subMesh.getRenderingMesh();
                var scene = _this._scene;
                var engine = scene.getEngine();
                // Culling
                engine.setState(subMesh.getMaterial().backFaceCulling);
                // Managing instances
                var batch = mesh._getInstancesRenderList(subMesh._id);
                if (batch.mustReturn) {
                    return;
                }
                var hardwareInstancedRendering = (engine.getCaps().instancedArrays) && (batch.visibleInstances[subMesh._id] !== null);
                if (_this.isReady(subMesh, hardwareInstancedRendering)) {
                    engine.enableEffect(_this._effect);
                    mesh._bind(subMesh, _this._effect, BABYLON.Material.TriangleFillMode);
                    var material = subMesh.getMaterial();
                    _this._effect.setMatrix("viewProjection", scene.getTransformMatrix());
                    _this._effect.setFloat2("depthValues", scene.activeCamera.minZ, scene.activeCamera.minZ + scene.activeCamera.maxZ);
                    // Alpha test
                    if (material && material.needAlphaTesting()) {
                        var alphaTexture = material.getAlphaTestTexture();
                        _this._effect.setTexture("diffuseSampler", alphaTexture);
                        _this._effect.setMatrix("diffuseMatrix", alphaTexture.getTextureMatrix());
                    }
                    // Bones
                    if (mesh.useBones && mesh.computeBonesUsingShaders) {
                        _this._effect.setMatrices("mBones", mesh.skeleton.getTransformMatrices(mesh));
                    }
                    // Draw
                    mesh._processRendering(subMesh, _this._effect, BABYLON.Material.TriangleFillMode, batch, hardwareInstancedRendering, function (isInstance, world) { return _this._effect.setMatrix("world", world); });
                }
            }
1304911
public static void main(final String[] args)
    throws Exception
  {
    if (args.length < 1) {
      LOG.info("usage: example-class");
      System.exit(1);
    }

    final ExampleType ex = lookupExample(args[0]);

    final GLProfile pro = GLProfile.get(GLProfile.GL3);
    final GLCapabilities caps = new GLCapabilities(pro);
    final GLWindow window = GLWindow.create(caps);
    window.setSize(640, 480);
    window.addGLEventListener(new ExampleEventListener(ex));
    window.setDefaultCloseOperation(
      WindowClosingProtocol.WindowClosingMode.DISPOSE_ON_CLOSE);
    window.setVisible(true);
    window.setTitle("Examples: " + args[0]);

    final Animator anim = new Animator(window);

    /*
     * Close the program when the window closes.
     */

    window.addWindowListener(new WindowAdapter()
    {
      @Override
      public void windowDestroyed(
        final WindowEvent e)
      {
        LOG.debug("Stopping animator");
        anim.stop();
        LOG.debug("Exiting");
        System.exit(0);
      }
    });

    anim.start();
  }
646297
def expose_init(self, *args):
        
        # Obtain a reference to the OpenGL drawable
        # and rendering context.
        gldrawable = self.get_gl_drawable()
        glcontext = self.get_gl_context()

        # OpenGL begin
        if not gldrawable or not gldrawable.gl_begin(glcontext):
            return False

        # logger.debug("expose_init")

        # Reset buffers
        glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT)

        # Prepare name stack
        glInitNames()
        glPushName(0)
        self.name_counter = 1

        return False
556895
function(editor, openWindowFn) {
  this.editor = editor;
  this.openWindowFn = openWindowFn;
  this.supportedEditors = this._getSupportedEditors();
  if (this.editor && !this._isSupportedEditor(this.editor)) {
    throw new Error(this.editor+' was not found in list of supported editors. Please check your global settings to ensure the self.editor path for '+this.editor+' is configured correctly.');
  }
}
979572
private void initialize() {
        frame = new GameFrame( "Wumpus World" );
        frame.getContentPane().setBackground( Color.WHITE );
        frame.setDefaultCloseOperation(wumpusWorldConfiguration.isExitOnClose() ? JFrame.EXIT_ON_CLOSE : JFrame.DISPOSE_ON_CLOSE);
        frame.setLayout(new MigLayout("", "[540px:n][grow,fill]", "[30px,top][300px,top][100px,top][grow]"));
        frame.setSize( 926, 603 );
        frame.setLocationRelativeTo(null); // Center in screen
        
        JPanel scorePanel = new JPanel();
        FlowLayout flowLayout = (FlowLayout) scorePanel.getLayout();
        flowLayout.setAlignment(FlowLayout.LEFT);
        scorePanel.setBackground(Color.WHITE);
        frame.getContentPane().add(scorePanel, "cell 0 0,grow");
        
        JLabel lblScore = new JLabel("Score");
        scorePanel.add(lblScore);
        
        final JTextField txtScore = new JTextField();
        gameView.getKsession().getChannels().put( "score", new Channel() {            
            public void send(Object object) {
                txtScore.setText( "" + ((Score ) object).getValue() );
            }
        } );
        
        txtScore.setEditable(false);
        scorePanel.add(txtScore);
        txtScore.setColumns(10);
        
        JScrollPane scrollPane = new JScrollPane();
        frame.getContentPane().add(scrollPane, "cell 1 0 1 4,grow");

        JPanel actionPanel = new JPanel();
        actionPanel.setBackground( Color.WHITE );
        frame.getContentPane().add(actionPanel, "cell 0 1,grow");
        actionPanel.setLayout( new MigLayout("", "[200px,left][320px:n]", "[grow]") );

        JPanel controls = new JPanel();
        controls.setBackground( Color.WHITE );
        controls.setLayout( new MigLayout( "", "[grow,fill]", "[::100px,top][200px,top]" ) );
        controls.add( drawActionPanel(), "cell 0 0,alignx left,aligny top" );

        controls.add( drawMovePanel(), "cell 0 1,alignx left,growy" );

        actionPanel.add( controls, "cell 0 0,grow" );

        cavePanel = drawCave();
        actionPanel.add(cavePanel, "cell 1 0,grow" );

        sensorPanel = drawSensorPanel();

        frame.getContentPane().add(sensorPanel, "cell 0 2,grow");
        
        JPanel blank = new JPanel();
        blank.setBackground(Color.WHITE);
        frame.add(blank, "cell 0 3,grow");

        frame.setVisible( true );

        cavePanel.getBufferedImage();
        sensorPanel.getBufferedImage();

        repaint();

    }
1328947
def main():
    
    print("|---------------------------------------------------")
    print("|          Virtual AI Simulator")
    print("|---------------------------------------------------")
    print("| ")
    print("| r = rebuild planets        c = create character")
    print("| s = simulation             o = create opponent")
    print("| q = quit                   b = battle characters")
    print("| ")
    
    planets = load_planet_list()
    show_planet_shortlist(planets)
    print("|---------------------------------------------------")
    cmd = input('| Enter choice ?' )
    if cmd == 'r':
        rebuild_planet_samples()
    elif cmd == 'q':
        exit(0)
    elif cmd < str(len(planets)+1) and cmd > '0':
        fname = planets[int(cmd) - 1]['name'] + '.txt'
        print('viewing planet ' + fname)
        view_world.display_map(fldr + os.sep + fname)
    elif cmd == 'c':
        c1 = create_character()
    elif cmd == 'o':
        c2 = create_character()
    elif cmd == 'b':
        run_simulation(c1, c2)
    elif cmd == 's':
        print('not implemented')
    else:
        print('invalid command ' + cmd)
    main()
44853
private void addInteractiveExamples() {
		add(new WHeading(HeadingLevel.H2, "Simple WCheckBoxSelect examples"));
		addExampleUsingLookupTable();
		addExampleUsingArrayList();
		addExampleUsingStringArray();
		addInsideAFieldLayoutExamples();
		add(new WHeading(HeadingLevel.H2, "Examples showing LAYOUT properties"));
		addFlatSelectExample();
		addColumnSelectExample();
		addSingleColumnSelectExample();
		add(new WHeading(HeadingLevel.H2, "WCheckBoxSelect showing the frameless state"));
		add(new WHeading(HeadingLevel.H3, "Normal (with frame)"));
		WCheckBoxSelect select = new WCheckBoxSelect("australian_state");
		add(select);
		select.setToolTip("Make a selection");
		add(new WHeading(HeadingLevel.H3, "Without frame"));
		select = new WCheckBoxSelect("australian_state");
		add(select);
		select.setFrameless(true);
		select.setToolTip("Make a selection (no frame)");
	}
669028
def world_command_examples():
    """"""
    env = holodeck.make("MazeWorld")

    # This is the unaltered MazeWorld
    for _ in range(300):
        _ = env.tick()
    env.reset()

    # The set_day_time_command sets the hour between 0 and 23 (military time). This example sets it to 6 AM.
    env.set_day_time(6)
    for _ in range(300):
        _ = env.tick()
    env.reset()  # reset() undoes all alterations to the world

    # The start_day_cycle command starts rotating the sun to emulate day cycles.
    # The parameter sets the day length in minutes.
    env.start_day_cycle(5)
    for _ in range(1500):
        _ = env.tick()
    env.reset()

    # The set_fog_density changes the density of the fog in the world. 1 is the maximum density.
    env.set_fog_density(.25)
    for _ in range(300):
        _ = env.tick()
    env.reset()

    # The set_weather_command changes the weather in the world. The two available options are "rain" and "cloudy".
    # The rainfall particle system is attached to the agent, so the rain particles will only be found around each agent.
    # Every world is clear by default.
    env.set_weather("rain")
    for _ in range(500):
        _ = env.tick()
    env.reset()

    env.set_weather("cloudy")
    for _ in range(500):
        _ = env.tick()
    env.reset()

    env.teleport_camera([1000, 1000, 1000], [0, 0, 0])
    for _ in range(500):
        _ = env.tick()
    env.reset()