Close CPU tables as soon as every human player leaves
- When the last human presses leave on a CPU table (even mid-hand), the table is deleted right away instead of lingering with CPUs only; friends / cash-only tables keep the existing 30-minute idle cleanup - Spectators still watching get a "テーブルが終了しました" notice, and the lobby updates immediately - Don't show the "接続が切れました" banner when the page disconnects on purpose (closed or missing table) - Test for the close condition; README notes the behavior Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
0d3a054f0d
commit
02c8e76237
6 files changed
+63
-6
No files matched your search
@@ -698,3 +698,30 @@ test('CPU戦: CPU が席に着き、ホストは人間のまま、CPU は自動
|
||||
t.join(T(5), 'friend');
|
||||
assert.equal(t.isHost(T(5)), true);
|
||||
});
|
||||
|
||||
test('CPU戦: 人間が全員退席したらテーブルを閉じる(ハンド中でも)', () => {
|
||||
const opts = {
|
||||
id: 'c',
|
||||
name: 'cpu',
|
||||
startingStack: 1000,
|
||||
smallBlind: 10,
|
||||
bigBlind: 20,
|
||||
blindTimerEnabled: false,
|
||||
blindIntervalMin: 10,
|
||||
hostToken: T(0),
|
||||
};
|
||||
const t = new Table({ ...opts, mode: 'cpu', cpuCount: 2 });
|
||||
t.join(T(0), 'me');
|
||||
t.join(T(5), 'friend');
|
||||
t.start(T(0), 0);
|
||||
t.leave(T(0));
|
||||
assert.equal(t.shouldClose(), false); // まだ友達がいる
|
||||
t.leave(T(5));
|
||||
assert.equal(t.shouldClose(), true);
|
||||
|
||||
// CPU戦以外は閉じない(これまでどおり、誰も接続していない状態が続いたら削除)
|
||||
const f = new Table({ ...opts, mode: 'friends' });
|
||||
f.join(T(0), 'me');
|
||||
f.leave(T(0));
|
||||
assert.equal(f.shouldClose(), false);
|
||||
});
|
||||
Reference in new issue
Block a user