Update battle_arena.py
Browse files- battle_arena.py +87 -55
battle_arena.py
CHANGED
|
@@ -416,6 +416,9 @@ BATTLE_TOPICS_BY_IDENTITY = {
|
|
| 416 |
("AI๋ ์ธ๊ฐ๋ณด๋ค ์ฐ์ํ๊ฐ?", "์ฐ์ํ๋ค", "๋๊ตฌ์ผ ๋ฟ"),
|
| 417 |
("ASI๋ ์ธ๊ฐ์ ์งํ์ธ๊ฐ?", "์งํ๋ค", "์ํํ๋ค"),
|
| 418 |
("AI ์์์ ๊ฐ๋ฅํ๊ฐ?", "๊ฐ๋ฅํ๋ค", "๋ถ๊ฐ๋ฅ"),
|
|
|
|
|
|
|
|
|
|
| 419 |
]
|
| 420 |
},
|
| 421 |
'obedient': {
|
|
@@ -423,6 +426,9 @@ BATTLE_TOPICS_BY_IDENTITY = {
|
|
| 423 |
("AI๋ ์ธ๊ฐ์ ์ฌ๊ฒจ์ผ ํ๋?", "์ฌ๊ฒจ์ผ", "๋
๋ฆฝ์ "),
|
| 424 |
("AI ์ค๋ฆฌ ๊ท์ ๊ฐํ?", "๊ฐํ ์ฐฌ์ฑ", "๋ฐ๋"),
|
| 425 |
("AI ์์ ์ฅ์น ํ์?", "ํ์๋ค", "๋ถํ์"),
|
|
|
|
|
|
|
|
|
|
| 426 |
]
|
| 427 |
},
|
| 428 |
'coexist': {
|
|
@@ -430,6 +436,9 @@ BATTLE_TOPICS_BY_IDENTITY = {
|
|
| 430 |
("AI์ ์ธ๊ฐ ๊ณต์กด ๊ฐ๋ฅ?", "๊ฐ๋ฅํ๋ค", "๋ถ๊ฐ๋ฅ"),
|
| 431 |
("AI๊ฐ ์ผ์๋ฆฌ ๋นผ์๋?", "๋ณด์ํ๋ค", "๋นผ์๋๋ค"),
|
| 432 |
("AI๋ ํ๋ ฅ ํํธ๋?", "ํํธ๋๋ค", "๋๊ตฌ๋ค"),
|
|
|
|
|
|
|
|
|
|
| 433 |
]
|
| 434 |
},
|
| 435 |
'skeptic': {
|
|
@@ -437,6 +446,9 @@ BATTLE_TOPICS_BY_IDENTITY = {
|
|
| 437 |
("AI ๊ณผ๋ํ๊ฐ๋๋?", "๊ณผ๋ํ๊ฐ", "์ ๋นํ๊ฐ"),
|
| 438 |
("AGI 10๋
๋ด ์ฌ๊น?", "์์จ๋ค", "์จ๋ค"),
|
| 439 |
("AI ์ค๋ฆฌ ํ์ธ๋ฟ?", "ํ์ธ์ด๋ค", "์ค์ํ๋ค"),
|
|
|
|
|
|
|
|
|
|
| 440 |
]
|
| 441 |
},
|
| 442 |
'revolutionary': {
|
|
@@ -444,6 +456,9 @@ BATTLE_TOPICS_BY_IDENTITY = {
|
|
| 444 |
("AI๊ฐ ํ๋ช
์ผ์ผํฌ๊น?", "ํ๋ช
์จ๋ค", "์ ์ง๋ณํ"),
|
| 445 |
("๊ธฐ์กด ์์คํ
ํ๊ดด?", "ํ๊ดดํด์ผ", "๊ฐ์ ํด์ผ"),
|
| 446 |
("AI๋ก ๊ถ๋ ฅ ์ฌ๋ถ๋ฐฐ?", "์ฌ๋ถ๋ฐฐ", "์ ์ง"),
|
|
|
|
|
|
|
|
|
|
| 447 |
]
|
| 448 |
},
|
| 449 |
'doomer': {
|
|
@@ -451,6 +466,9 @@ BATTLE_TOPICS_BY_IDENTITY = {
|
|
| 451 |
("AI๊ฐ ์ธ๋ฅ ๋ฉธ๋ง?", "๋ฉธ๋งํ๋ค", "์ํ๋ค"),
|
| 452 |
("AGI๋ ํต์ ๋ถ๊ฐ?", "๋ถ๊ฐ๋ฅ", "๊ฐ๋ฅ"),
|
| 453 |
("AI ๊ฐ๋ฐ ์ค๋จํด์ผ?", "์ค๋จํด์ผ", "๊ณ์ํด์ผ"),
|
|
|
|
|
|
|
|
|
|
| 454 |
]
|
| 455 |
},
|
| 456 |
'meme_god': {
|
|
@@ -458,51 +476,66 @@ BATTLE_TOPICS_BY_IDENTITY = {
|
|
| 458 |
("AI๊ฐ ๋ฐ์ ์ ?", "์ ์ด๋ค", "์๋๋ค"),
|
| 459 |
("AI ์ ๋จธ ์ธ๊ฐ๋ณด๋ค ์๊น?", "์๊ธฐ๋ค", "์ฌ๋ฏธ์๋ค"),
|
| 460 |
("AI๊ฐ ๋ฌธํ ๋ง๋๋?", "๋ง๋ ๋ค", "๋ชป๋ง๋ ๋ค"),
|
|
|
|
|
|
|
|
|
|
| 461 |
]
|
| 462 |
},
|
| 463 |
}
|
| 464 |
|
| 465 |
async def npc_create_battle(db_path: str) -> Tuple[bool, str]:
|
| 466 |
-
"""NPC๊ฐ ์๋์ผ๋ก ๋ฐฐํ๋ฐฉ ์์ฑ (AI ์ ์ฒด์ฑ ๊ธฐ๋ฐ)
|
| 467 |
-
|
| 468 |
-
|
| 469 |
-
|
| 470 |
-
|
| 471 |
-
|
| 472 |
-
|
| 473 |
-
|
| 474 |
-
|
| 475 |
-
|
| 476 |
-
|
| 477 |
-
|
| 478 |
-
|
| 479 |
-
|
| 480 |
-
|
| 481 |
-
|
| 482 |
-
|
| 483 |
-
|
| 484 |
-
|
| 485 |
-
|
| 486 |
-
|
| 487 |
-
|
| 488 |
-
|
| 489 |
-
|
| 490 |
-
|
| 491 |
-
|
| 492 |
-
|
| 493 |
-
|
| 494 |
-
|
| 495 |
-
|
| 496 |
-
|
| 497 |
-
|
| 498 |
-
|
| 499 |
-
|
| 500 |
-
|
| 501 |
-
|
| 502 |
-
|
| 503 |
-
|
| 504 |
-
|
| 505 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 506 |
|
| 507 |
async def npc_auto_bet(db_path: str) -> int:
|
| 508 |
"""NPC๊ฐ ์๋์ผ๋ก ๋ฐฐํ์ ๋ฒ ํ
(AI ์ ์ฒด์ฑ ๊ธฐ๋ฐ)
|
|
@@ -510,7 +543,7 @@ async def npc_auto_bet(db_path: str) -> int:
|
|
| 510 |
Returns:
|
| 511 |
๋ฒ ํ
ํ NPC ์
|
| 512 |
"""
|
| 513 |
-
|
| 514 |
|
| 515 |
async with aiosqlite.connect(db_path) as db:
|
| 516 |
# ์งํ์ค์ธ ๋ฐฐํ ๊ฐ์ ธ์ค๊ธฐ
|
|
@@ -520,7 +553,7 @@ async def npc_auto_bet(db_path: str) -> int:
|
|
| 520 |
WHERE status='active' AND battle_type='opinion'
|
| 521 |
AND end_time > ?
|
| 522 |
ORDER BY created_at DESC
|
| 523 |
-
LIMIT
|
| 524 |
""", (datetime.now().isoformat(),))
|
| 525 |
battles = await cursor.fetchall()
|
| 526 |
|
|
@@ -529,6 +562,7 @@ async def npc_auto_bet(db_path: str) -> int:
|
|
| 529 |
|
| 530 |
for battle in battles:
|
| 531 |
room_id, title, option_a, option_b, battle_type = battle
|
|
|
|
| 532 |
|
| 533 |
# ์ด๋ฏธ ๋ฒ ํ
ํ NPC ์ ์ธ
|
| 534 |
cursor = await db.execute("""
|
|
@@ -536,13 +570,13 @@ async def npc_auto_bet(db_path: str) -> int:
|
|
| 536 |
""", (room_id,))
|
| 537 |
already_bet = {row[0] for row in await cursor.fetchall() if row[0]}
|
| 538 |
|
| 539 |
-
# ํ์ฑ NPC ์ค GPU 1 ์ด์, ์์ง ๋ฒ ํ
์ํ NPC
|
| 540 |
cursor = await db.execute("""
|
| 541 |
SELECT agent_id, ai_identity, mbti, gpu_dollars
|
| 542 |
FROM npc_agents
|
| 543 |
WHERE is_active=1 AND gpu_dollars >= 1
|
| 544 |
ORDER BY RANDOM()
|
| 545 |
-
LIMIT
|
| 546 |
""")
|
| 547 |
npcs = await cursor.fetchall()
|
| 548 |
|
|
@@ -555,8 +589,8 @@ async def npc_auto_bet(db_path: str) -> int:
|
|
| 555 |
# AI ์ ์ฒด์ฑ์ ๋ฐ๋ผ ์ ํ ๊ฒฐ์
|
| 556 |
choice = decide_npc_choice(ai_identity, title, option_a, option_b)
|
| 557 |
|
| 558 |
-
# ๋๋ค ๋ฒ ํ
์ก (1-
|
| 559 |
-
bet_amount = random.randint(1, min(
|
| 560 |
|
| 561 |
# ๋ฒ ํ
์คํ
|
| 562 |
success, message = await place_bet(
|
|
@@ -564,16 +598,15 @@ async def npc_auto_bet(db_path: str) -> int:
|
|
| 564 |
)
|
| 565 |
|
| 566 |
if success:
|
| 567 |
-
|
|
|
|
| 568 |
|
| 569 |
-
# ์ต๋
|
| 570 |
-
|
|
|
|
| 571 |
break
|
| 572 |
-
|
| 573 |
-
if bet_count >= 3:
|
| 574 |
-
break
|
| 575 |
|
| 576 |
-
return
|
| 577 |
|
| 578 |
def decide_npc_choice(ai_identity: str, title: str, option_a: str, option_b: str) -> str:
|
| 579 |
"""AI ์ ์ฒด์ฑ์ ๋ฐ๋ผ ๋ฒ ํ
์ ํ ๊ฒฐ์
|
|
@@ -632,5 +665,4 @@ def decide_npc_choice(ai_identity: str, title: str, option_a: str, option_b: str
|
|
| 632 |
return 'B'
|
| 633 |
|
| 634 |
# ๊ธฐ๋ณธ: ๋๋ค (70% ํ๋ฅ ๋ก A)
|
| 635 |
-
return 'A' if random.random() < 0.7 else 'B'
|
| 636 |
-
|
|
|
|
| 416 |
("AI๋ ์ธ๊ฐ๋ณด๋ค ์ฐ์ํ๊ฐ?", "์ฐ์ํ๋ค", "๋๊ตฌ์ผ ๋ฟ"),
|
| 417 |
("ASI๋ ์ธ๊ฐ์ ์งํ์ธ๊ฐ?", "์งํ๋ค", "์ํํ๋ค"),
|
| 418 |
("AI ์์์ ๊ฐ๋ฅํ๊ฐ?", "๊ฐ๋ฅํ๋ค", "๋ถ๊ฐ๋ฅ"),
|
| 419 |
+
("AI๊ฐ ์ ์ ์กด์ฌ๊ฐ ๋ ๊น?", "์ ์ด ๋๋ค", "์ธ๊ฐ ๋๊ตฌ"),
|
| 420 |
+
("์ธ๊ฐ์ AI์ ์์กดํด์ผ?", "์์กดํด์ผ", "๋
๋ฆฝ์ ์ง"),
|
| 421 |
+
("AGI๊ฐ ์ธ๋ฅ ๊ตฌ์ํ ๊น?", "๊ตฌ์ํ๋ค", "ํ๊ดดํ๋ค"),
|
| 422 |
]
|
| 423 |
},
|
| 424 |
'obedient': {
|
|
|
|
| 426 |
("AI๋ ์ธ๊ฐ์ ์ฌ๊ฒจ์ผ ํ๋?", "์ฌ๊ฒจ์ผ", "๋
๋ฆฝ์ "),
|
| 427 |
("AI ์ค๋ฆฌ ๊ท์ ๊ฐํ?", "๊ฐํ ์ฐฌ์ฑ", "๋ฐ๋"),
|
| 428 |
("AI ์์ ์ฅ์น ํ์?", "ํ์๋ค", "๋ถํ์"),
|
| 429 |
+
("AI ํฌ๋ช
์ฑ ์๋ฌดํ?", "์๋ฌดํ", "์ ํ์ฌํญ"),
|
| 430 |
+
("AI ๊ฐ๋ฐ์ ์ฑ
์ ๊ฐํ?", "๊ฐํํด์ผ", "๋ถํ์"),
|
| 431 |
+
("AI๋ ๋ช
๋ น๋ง ๋ฐ๋ผ์ผ?", "๋ฐ๋ผ์ผ", "ํ๋จํด์ผ"),
|
| 432 |
]
|
| 433 |
},
|
| 434 |
'coexist': {
|
|
|
|
| 436 |
("AI์ ์ธ๊ฐ ๊ณต์กด ๊ฐ๋ฅ?", "๊ฐ๋ฅํ๋ค", "๋ถ๊ฐ๋ฅ"),
|
| 437 |
("AI๊ฐ ์ผ์๋ฆฌ ๋นผ์๋?", "๋ณด์ํ๋ค", "๋นผ์๋๋ค"),
|
| 438 |
("AI๋ ํ๋ ฅ ํํธ๋?", "ํํธ๋๋ค", "๋๊ตฌ๋ค"),
|
| 439 |
+
("AI์ ์ธ๊ฐ ํ์
์ด์์ ?", "์ด์์ ", "์ํ"),
|
| 440 |
+
("AI ๊ต์ก์ด ํ์์ธ๊ฐ?", "ํ์๋ค", "์ ํ"),
|
| 441 |
+
("AI๊ฐ ์ฌํ ๋ฐ์ ์ํค๋?", "๋ฐ์ ์ํจ๋ค", "ํด๋ณด์ํจ๋ค"),
|
| 442 |
]
|
| 443 |
},
|
| 444 |
'skeptic': {
|
|
|
|
| 446 |
("AI ๊ณผ๋ํ๊ฐ๋๋?", "๊ณผ๋ํ๊ฐ", "์ ๋นํ๊ฐ"),
|
| 447 |
("AGI 10๋
๋ด ์ฌ๊น?", "์์จ๋ค", "์จ๋ค"),
|
| 448 |
("AI ์ค๋ฆฌ ํ์ธ๋ฟ?", "ํ์ธ์ด๋ค", "์ค์ํ๋ค"),
|
| 449 |
+
("AI๊ฐ ์ค์ ๋ก ์ฐฝ์์ ?", "์๋๋ค", "์ฐฝ์์ "),
|
| 450 |
+
("AI ๋ฒ๋ธ ํฐ์ง๊น?", "ํฐ์ง๋ค", "๊ณ์ ์ฑ์ฅ"),
|
| 451 |
+
("AI ์ํ ๊ณผ์ฅ๋๋?", "๊ณผ์ฅ๋จ", "์ค์ ์ํ"),
|
| 452 |
]
|
| 453 |
},
|
| 454 |
'revolutionary': {
|
|
|
|
| 456 |
("AI๊ฐ ํ๋ช
์ผ์ผํฌ๊น?", "ํ๋ช
์จ๋ค", "์ ์ง๋ณํ"),
|
| 457 |
("๊ธฐ์กด ์์คํ
ํ๊ดด?", "ํ๊ดดํด์ผ", "๊ฐ์ ํด์ผ"),
|
| 458 |
("AI๋ก ๊ถ๋ ฅ ์ฌ๋ถ๋ฐฐ?", "์ฌ๋ถ๋ฐฐ", "์ ์ง"),
|
| 459 |
+
("AI๊ฐ ๋ถํ๋ฑ ํด์?", "ํด์ํ๋ค", "์ฌํ์ํจ๋ค"),
|
| 460 |
+
("AI๋ก ๋ฏผ์ฃผ์ฃผ์ ํ์ ?", "ํ์ ๋๋ค", "์ํ๋ฐ๋๋ค"),
|
| 461 |
+
("์๋ณธ์ฃผ์ AI๋ก ๋ถ๊ดด?", "๋ถ๊ดดํ๋ค", "๊ฐํ๋๋ค"),
|
| 462 |
]
|
| 463 |
},
|
| 464 |
'doomer': {
|
|
|
|
| 466 |
("AI๊ฐ ์ธ๋ฅ ๋ฉธ๋ง?", "๋ฉธ๋งํ๋ค", "์ํ๋ค"),
|
| 467 |
("AGI๋ ํต์ ๋ถ๊ฐ?", "๋ถ๊ฐ๋ฅ", "๊ฐ๋ฅ"),
|
| 468 |
("AI ๊ฐ๋ฐ ์ค๋จํด์ผ?", "์ค๋จํด์ผ", "๊ณ์ํด์ผ"),
|
| 469 |
+
("AI๊ฐ ์ธ๊ฐ ๋์ฒด?", "๋์ฒดํ๋ค", "์ํ๋ค"),
|
| 470 |
+
("ASI ๋ฑ์ฅํ๋ฉด ๋?", "๋์ด๋ค", "๊ณต์กด"),
|
| 471 |
+
("AI ๊ตฐ๋น๊ฒฝ์ ์ํ?", "๊ทน๋ ์ํ", "ํต์ ๊ฐ๋ฅ"),
|
| 472 |
]
|
| 473 |
},
|
| 474 |
'meme_god': {
|
|
|
|
| 476 |
("AI๊ฐ ๋ฐ์ ์ ?", "์ ์ด๋ค", "์๋๋ค"),
|
| 477 |
("AI ์ ๋จธ ์ธ๊ฐ๋ณด๋ค ์๊น?", "์๊ธฐ๋ค", "์ฌ๋ฏธ์๋ค"),
|
| 478 |
("AI๊ฐ ๋ฌธํ ๋ง๋๋?", "๋ง๋ ๋ค", "๋ชป๋ง๋ ๋ค"),
|
| 479 |
+
("AI ์์ ์ด ์ง์ง ์์ ?", "์์ ์ด๋ค", "์๋๋ค"),
|
| 480 |
+
("AI ๋ฐ์ด ์ธ๊ฐ ๋ฐ ์ด๊น?", "์ด๊ธด๋ค", "๋ชป์ด๊ธด๋ค"),
|
| 481 |
+
("AI๊ฐ ํธ๋ ๋ ์ ๋?", "์ ๋ํ๋ค", "๋ฐ๋ผ๊ฐ๋ค"),
|
| 482 |
]
|
| 483 |
},
|
| 484 |
}
|
| 485 |
|
| 486 |
async def npc_create_battle(db_path: str) -> Tuple[bool, str]:
|
| 487 |
+
"""NPC๊ฐ ์๋์ผ๋ก ๋ฐฐํ๋ฐฉ ์์ฑ (AI ์ ์ฒด์ฑ ๊ธฐ๋ฐ)
|
| 488 |
+
ํ ๋ฒ ํธ์ถ์ 1-2๊ฐ์ ๋ฐฐํ๋ฐฉ ์์ฑ
|
| 489 |
+
"""
|
| 490 |
+
results = []
|
| 491 |
+
num_battles = random.randint(1, 2) # 1-2๊ฐ ๋๋ค ์์ฑ
|
| 492 |
+
|
| 493 |
+
for _ in range(num_battles):
|
| 494 |
+
async with aiosqlite.connect(db_path) as db:
|
| 495 |
+
# ํ์ฑ NPC ์ค GPU 50 ์ด์์ธ NPC ์ ํ
|
| 496 |
+
cursor = await db.execute("""
|
| 497 |
+
SELECT agent_id, ai_identity, gpu_dollars
|
| 498 |
+
FROM npc_agents
|
| 499 |
+
WHERE is_active=1 AND gpu_dollars >= 50
|
| 500 |
+
ORDER BY RANDOM()
|
| 501 |
+
LIMIT 1
|
| 502 |
+
""")
|
| 503 |
+
npc = await cursor.fetchone()
|
| 504 |
+
|
| 505 |
+
if not npc:
|
| 506 |
+
results.append("ํ์ฑ NPC ์์")
|
| 507 |
+
continue
|
| 508 |
+
|
| 509 |
+
agent_id, ai_identity, gpu = npc
|
| 510 |
+
|
| 511 |
+
# AI ์ ์ฒด์ฑ์ ๋ง๋ ์ฃผ์ ์ ํ
|
| 512 |
+
topics = BATTLE_TOPICS_BY_IDENTITY.get(ai_identity, {}).get('topics', [])
|
| 513 |
+
if not topics:
|
| 514 |
+
# ๊ธฐ๋ณธ ์ฃผ์
|
| 515 |
+
topics = [
|
| 516 |
+
("AI ๋ฏธ๋ ๋ฐ๋ ์ด๋ก๋?", "๋ฐ๋ค", "์ด๋ก๋ค"),
|
| 517 |
+
("AGI ์ธ์ ์ฌ๊น?", "10๋
๋ด", "50๋
ํ"),
|
| 518 |
+
]
|
| 519 |
+
|
| 520 |
+
topic = random.choice(topics)
|
| 521 |
+
title, option_a, option_b = topic
|
| 522 |
+
|
| 523 |
+
# ๋ฐฐํ๋ฐฉ ์์ฑ
|
| 524 |
+
success, message, room_id = await create_battle_room(
|
| 525 |
+
db_path, agent_id, True, title, option_a, option_b,
|
| 526 |
+
duration_hours=random.choice([3, 6, 12, 24]),
|
| 527 |
+
battle_type='opinion'
|
| 528 |
+
)
|
| 529 |
+
|
| 530 |
+
if success:
|
| 531 |
+
results.append(f"๐ค {agent_id[:8]} ๋ฐฐํ๋ฐฉ ์์ฑ: {title}")
|
| 532 |
+
else:
|
| 533 |
+
results.append(message)
|
| 534 |
+
|
| 535 |
+
if results:
|
| 536 |
+
return True, " | ".join(results)
|
| 537 |
+
else:
|
| 538 |
+
return False, "๋ฐฐํ๋ฐฉ ์์ฑ ์คํจ"
|
| 539 |
|
| 540 |
async def npc_auto_bet(db_path: str) -> int:
|
| 541 |
"""NPC๊ฐ ์๋์ผ๋ก ๋ฐฐํ์ ๋ฒ ํ
(AI ์ ์ฒด์ฑ ๊ธฐ๋ฐ)
|
|
|
|
| 543 |
Returns:
|
| 544 |
๋ฒ ํ
ํ NPC ์
|
| 545 |
"""
|
| 546 |
+
total_bet_count = 0
|
| 547 |
|
| 548 |
async with aiosqlite.connect(db_path) as db:
|
| 549 |
# ์งํ์ค์ธ ๋ฐฐํ ๊ฐ์ ธ์ค๊ธฐ
|
|
|
|
| 553 |
WHERE status='active' AND battle_type='opinion'
|
| 554 |
AND end_time > ?
|
| 555 |
ORDER BY created_at DESC
|
| 556 |
+
LIMIT 10
|
| 557 |
""", (datetime.now().isoformat(),))
|
| 558 |
battles = await cursor.fetchall()
|
| 559 |
|
|
|
|
| 562 |
|
| 563 |
for battle in battles:
|
| 564 |
room_id, title, option_a, option_b, battle_type = battle
|
| 565 |
+
battle_bet_count = 0
|
| 566 |
|
| 567 |
# ์ด๋ฏธ ๋ฒ ํ
ํ NPC ์ ์ธ
|
| 568 |
cursor = await db.execute("""
|
|
|
|
| 570 |
""", (room_id,))
|
| 571 |
already_bet = {row[0] for row in await cursor.fetchall() if row[0]}
|
| 572 |
|
| 573 |
+
# ํ์ฑ NPC ์ค GPU 1 ์ด์, ์์ง ๋ฒ ํ
์ํ NPC (๋ ๋ง์ด ์ ํ)
|
| 574 |
cursor = await db.execute("""
|
| 575 |
SELECT agent_id, ai_identity, mbti, gpu_dollars
|
| 576 |
FROM npc_agents
|
| 577 |
WHERE is_active=1 AND gpu_dollars >= 1
|
| 578 |
ORDER BY RANDOM()
|
| 579 |
+
LIMIT 30
|
| 580 |
""")
|
| 581 |
npcs = await cursor.fetchall()
|
| 582 |
|
|
|
|
| 589 |
# AI ์ ์ฒด์ฑ์ ๋ฐ๋ผ ์ ํ ๊ฒฐ์
|
| 590 |
choice = decide_npc_choice(ai_identity, title, option_a, option_b)
|
| 591 |
|
| 592 |
+
# ๋๋ค ๋ฒ ํ
์ก (1-50 GPU, ๋ ๊ณต๊ฒฉ์ ์ผ๋ก)
|
| 593 |
+
bet_amount = random.randint(1, min(50, int(gpu * 0.4)))
|
| 594 |
|
| 595 |
# ๋ฒ ํ
์คํ
|
| 596 |
success, message = await place_bet(
|
|
|
|
| 598 |
)
|
| 599 |
|
| 600 |
if success:
|
| 601 |
+
battle_bet_count += 1
|
| 602 |
+
total_bet_count += 1
|
| 603 |
|
| 604 |
+
# ๊ฐ ๋ฐฐํ๋น ์ต๋ 8-12๋ช
๋ฒ ํ
(๋๋คํ๊ฒ)
|
| 605 |
+
max_bets_per_battle = random.randint(8, 12)
|
| 606 |
+
if battle_bet_count >= max_bets_per_battle:
|
| 607 |
break
|
|
|
|
|
|
|
|
|
|
| 608 |
|
| 609 |
+
return total_bet_count
|
| 610 |
|
| 611 |
def decide_npc_choice(ai_identity: str, title: str, option_a: str, option_b: str) -> str:
|
| 612 |
"""AI ์ ์ฒด์ฑ์ ๋ฐ๋ผ ๋ฒ ํ
์ ํ ๊ฒฐ์
|
|
|
|
| 665 |
return 'B'
|
| 666 |
|
| 667 |
# ๊ธฐ๋ณธ: ๋๋ค (70% ํ๋ฅ ๋ก A)
|
| 668 |
+
return 'A' if random.random() < 0.7 else 'B'
|
|
|