add: absorb uno-online as regular subdirectory

UNO card game web app (Node.js/React) with Miku bot integration.
Previously an independent git repo (fork of mizanxali/uno-online).
Removed .git/ and absorbed into main repo for unified tracking.

Includes bot integration code: botActionExecutor, cardParser,
gameStateBuilder, and server-side bot action support.
37 files, node_modules excluded via local .gitignore.
This commit is contained in:
2026-03-04 00:21:38 +02:00
parent c708770266
commit 34b184a05a
37 changed files with 26885 additions and 0 deletions

76
uno-online/test-bot-action.js Executable file
View File

@@ -0,0 +1,76 @@
/**
* Test script for bot actions
* Usage: node test-bot-action.js <roomCode> <action>
*
* Examples:
* node test-bot-action.js ABC123 '{"action":"draw"}'
* node test-bot-action.js ABC123 '{"action":"play","card":"4R"}'
* node test-bot-action.js ABC123 '{"action":"play","card":"W","color":"R"}'
* node test-bot-action.js ABC123 '{"action":"uno"}'
*/
const http = require('http');
const roomCode = process.argv[2];
const actionJson = process.argv[3];
if (!roomCode || !actionJson) {
console.error('❌ Usage: node test-bot-action.js <roomCode> <actionJson>');
console.error('Example: node test-bot-action.js ABC123 \'{"action":"draw"}\'');
process.exit(1);
}
let action;
try {
action = JSON.parse(actionJson);
} catch (e) {
console.error('❌ Invalid JSON:', e.message);
process.exit(1);
}
console.log(`🤖 Sending bot action to room ${roomCode}:`);
console.log(JSON.stringify(action, null, 2));
const postData = JSON.stringify(action);
const options = {
hostname: 'localhost',
port: 5000,
path: `/api/game/${roomCode}/action`,
method: 'POST',
headers: {
'Content-Type': 'application/json',
'Content-Length': Buffer.byteLength(postData)
}
};
const req = http.request(options, (res) => {
let data = '';
res.on('data', (chunk) => {
data += chunk;
});
res.on('end', () => {
console.log(`\n📡 Response (${res.statusCode}):`);
try {
const response = JSON.parse(data);
console.log(JSON.stringify(response, null, 2));
if (response.success) {
console.log('✅ Action sent successfully!');
} else {
console.log('❌ Action failed');
}
} catch (e) {
console.log(data);
}
});
});
req.on('error', (e) => {
console.error('❌ Request failed:', e.message);
console.error('Make sure the server is running on port 5000');
});
req.write(postData);
req.end();