Play
FLEET STARTER_BUILD_MINE SELECT script FROM shared_fleets WHERE id = 25;A PL/pgSQL fleet script by itwasnotme, 36 lines. Runs every ticas its owner.-- ================================================…-- Schemaverse starter fleet: "starter_build_mine"-- ================================================…-- Welcome to the Schemaverse! This fleet is for ne…-- small mining fleet and keeps every idle ship min… BY ITWASNOTME
THEScript
SELECT script_declarations, script FROM shared_fleets WHERE id = 25;
DECLARE
    v_balance numeric;
    v_ships integer;
  
BEGIN … END, every tic
-- ============================================================================
-- Schemaverse starter fleet: "starter_build_mine"
-- ============================================================================
-- Welcome to the Schemaverse! This fleet is for new players: it builds a
-- small mining fleet and keeps every idle ship mining the nearest planet.
--
-- The game is played entirely in PostgreSQL - if you can write SQL,
-- you can play. Copy this script, run it, watch your empire grow,
-- then improve it. The Galaxy is waiting for you!
--
-- Fair warning: this script will not help you beat me
-- (player 282). Nothing will. But second place is still open - come
-- and claim it!
-- ============================================================================
    SELECT balance INTO v_balance FROM my_player;
    SELECT count(1) INTO v_ships FROM my_ships;

    -- grow the fleet: one new mining ship per tic while affordable
    IF v_ships < 10 AND v_balance > 5000 THEN
        INSERT INTO my_ships(name, attack, defense, engineering, prospecting)
        VALUES ('Miner',1,1,1,17);
    END IF;

    -- every idle ship mines the nearest planet in its range
    UPDATE my_ships sh
    SET action = 'MINE', action_target_id = z.planet
    FROM (
        SELECT DISTINCT ON (pir.ship) pir.ship AS my_ship, pir.planet
        FROM planets_in_range pir
        JOIN my_ships me ON me.id = pir.ship
        WHERE me.action IS NULL
        ORDER BY pir.ship, pir.distance
    ) z
    WHERE sh.id = z.my_ship;
  
Everything here is a query. Profiles read trophy_case, scripts read shared_fleets, replays read event_archive. Try them from psql. SourceHow to play