Something went wrong. Try again.
Monorepo for Aesthetic.Computer aesthetic.computer
Something went wrong. Try again.
JavaScript
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155#!/usr/bin/env node/** * ๐ฎ 1v1 Split Test * * Test the split view for local 1v1 dueling scenarios. * Opens split with two pieces side by side for testing multiplayer interactions. * * Usage: node test-1v1-split.mjs [piece] [piece2] * * Examples: * node test-1v1-split.mjs prompt - Two prompts side by side * node test-1v1-split.mjs notepat - Two notepat instances * node test-1v1-split.mjs prompt notepat - Prompt on top, notepat on bottom */
import Artery from './artery.mjs';
// โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ// TERMINAL COLORS// โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโconst PURPLE_BG = '\x1b[45m';const WHITE = '\x1b[97m';const RESET = '\x1b[0m';const GREEN = '\x1b[92m';const CYAN = '\x1b[96m';const YELLOW = '\x1b[93m';const MAGENTA = '\x1b[95m';const RED = '\x1b[91m';const DIM = '\x1b[2m';const BOLD = '\x1b[1m';
const testLog = (msg) => console.log(`${PURPLE_BG}${WHITE}๐ฎ${RESET} ${msg}`);const successLog = (msg) => console.log(`${GREEN}โ
${msg}${RESET}`);const infoLog = (msg) => console.log(`${CYAN}โน๏ธ ${msg}${RESET}`);const warnLog = (msg) => console.log(`${YELLOW}โ ๏ธ ${msg}${RESET}`);
// โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ// MAIN// โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
export async function main() { const args = process.argv.slice(2); // Parse pieces from args - default to '1v1' for dueling let piece1 = '1v1'; let piece2 = null; for (const arg of args) { if (arg === 'help' || arg === '--help' || arg === '-h') { showHelp(); return; } // First non-help arg becomes piece1 if (piece1 === '1v1') { piece1 = arg; } else if (!piece2) { piece2 = arg; } } // If only one piece specified, use it for both if (!piece2) { piece2 = piece1; } console.log(`\n${BOLD}${MAGENTA}๐ฎ 1v1 Split Test${RESET}`); console.log(`${DIM}Testing split view for local multiplayer${RESET}\n`); infoLog(`Top panel: ${BOLD}${piece1}${RESET}`); infoLog(`Bottom panel: ${BOLD}${piece2}${RESET}\n`); testLog('Connecting to AC...\n'); const client = new Artery(); try { await client.connect(); testLog('Connected to AC'); // Build the split URL const splitPath = piece1 === piece2 ? `split~${piece1}` : `split~${piece1}~${piece2}`; testLog(`Navigating to: ${splitPath}`); // Navigate to split view using jump await client.jump(splitPath); // Wait for navigation await new Promise(resolve => setTimeout(resolve, 2000)); successLog('Split view loaded!\n'); console.log(`${DIM}โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ${RESET}`); console.log(`${BOLD}Split View Active${RESET}`); console.log(`${DIM}โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ${RESET}`); console.log(` Top: ${CYAN}${piece1}${RESET}`); console.log(` Bottom: ${CYAN}${piece2}${RESET}`); console.log(`${DIM}โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ${RESET}`); console.log(`\n${DIM}Press Ctrl+C to exit${RESET}\n`); // Keep connection alive for monitoring await new Promise((resolve) => { process.on('SIGINT', () => { console.log(`\n${YELLOW}Exiting...${RESET}`); resolve(); }); }); } catch (error) { console.error(`${RED}Error: ${error.message}${RESET}`); process.exit(1); } finally { client.disconnect(); testLog('Disconnected'); }}
function showHelp() { console.log(`${BOLD}${MAGENTA}๐ฎ 1v1 Split Test${RESET}${DIM}Test split view for local 1v1 dueling${RESET}
${BOLD}Usage:${RESET} node test-1v1-split.mjs [piece1] [piece2]
${BOLD}Arguments:${RESET} piece1 First piece (top panel), default: prompt piece2 Second piece (bottom panel), default: same as piece1
${BOLD}Examples:${RESET} ${DIM}# Two prompts side by side${RESET} node test-1v1-split.mjs prompt
${DIM}# Two notepat instances for music dueling${RESET} node test-1v1-split.mjs notepat
${DIM}# Different pieces - prompt on top, notepat on bottom${RESET} node test-1v1-split.mjs prompt notepat
${DIM}# Two drawing canvases${RESET} node test-1v1-split.mjs line
${BOLD}Notes:${RESET} - The split view creates two iframes, each running a piece - Each panel operates independently - Good for testing multiplayer/dueling scenarios locally - Use 'split~piece1~piece2' URL format directly in browser`);}
// Run if called directlymain().catch(console.error);