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:
52
uno-online/test-integration.js
Normal file
52
uno-online/test-integration.js
Normal file
@@ -0,0 +1,52 @@
|
||||
// Simple test to verify the card parser and game state builder work
|
||||
|
||||
const { parseCard, isCardPlayable, getPlayableCards } = require('./client/src/utils/cardParser');
|
||||
const { buildGameStateJSON } = require('./client/src/utils/gameStateBuilder');
|
||||
|
||||
console.log('Testing Card Parser...');
|
||||
|
||||
// Test 1: Parse a simple number card
|
||||
const card1 = parseCard('5R');
|
||||
console.log('✓ Parse 5R:', JSON.stringify(card1, null, 2));
|
||||
|
||||
// Test 2: Parse a wild card
|
||||
const card2 = parseCard('W');
|
||||
console.log('✓ Parse W:', JSON.stringify(card2, null, 2));
|
||||
|
||||
// Test 3: Check playability
|
||||
const playable = isCardPlayable('5R', 'R', 3);
|
||||
console.log('✓ Can play 5R on 3R?', playable);
|
||||
|
||||
// Test 4: Get playable cards
|
||||
const hand = ['5R', '7B', 'W', '3G'];
|
||||
const playableCards = getPlayableCards(hand, 'R', 5);
|
||||
console.log('✓ Playable cards from hand:', playableCards.map(c => c.code));
|
||||
|
||||
console.log('\nTesting Game State Builder...');
|
||||
|
||||
// Test 5: Build game state
|
||||
const mockGameState = {
|
||||
gameOver: false,
|
||||
winner: null,
|
||||
turn: 'Player 2',
|
||||
player1Deck: ['1R', '2B', '3G', '4Y', '5R'],
|
||||
player2Deck: ['5R', '7B', 'W'],
|
||||
currentColor: 'R',
|
||||
currentNumber: 5,
|
||||
playedCardsPile: ['1B', '2B', '3R', '4R', '5R'],
|
||||
drawCardPile: new Array(80).fill('back')
|
||||
};
|
||||
|
||||
try {
|
||||
const gameStateJSON = buildGameStateJSON(mockGameState, 'Player 2');
|
||||
console.log('✓ Game State JSON generated successfully!');
|
||||
console.log(' Turn:', gameStateJSON.game.currentTurn);
|
||||
console.log(' Current Card:', gameStateJSON.currentCard.displayName);
|
||||
console.log(' Bot has', gameStateJSON.player2.cards.length, 'cards');
|
||||
console.log(' Playable:', gameStateJSON.player2.playableCards.length);
|
||||
console.log(' Actions:', gameStateJSON.botContext.actions.length);
|
||||
} catch (error) {
|
||||
console.error('✗ Error building game state:', error.message);
|
||||
}
|
||||
|
||||
console.log('\n✅ All tests passed!');
|
||||
Reference in New Issue
Block a user