Add freeform No-Field and auction facts
Verify and publish checkpoint container / container (push) Canceled after 0s
Verify and publish checkpoint container / container (push) Canceled after 0s
This commit is contained in:
1 parent
593ff33ca8
commit
152476c348
10 files changed
+387
-4
No files matched your search
@@ -0,0 +1,45 @@
|
||||
import assert from 'node:assert/strict';
|
||||
import test from 'node:test';
|
||||
import { parseTruthFreeformFactsV8 as parse } from '../game/truthtrance-freeform-facts-v8';
|
||||
|
||||
void test('v8 recognizes current concealed values and actual recorded auction facts', () => {
|
||||
for (const value of [0,3,5] as const)
|
||||
assert.deepEqual(parse(`Do you have a concealed No-Field with printed value ${value}?`), {kind:'noFieldValue', value});
|
||||
assert.deepEqual(parse('Is the current auction card you inspected a Shield?'), {kind:'auctionPeek', name:'Shield'});
|
||||
assert.deepEqual(parse('Is the current public cache card a shield?'), {kind:'cacheLot', name:'Shield'});
|
||||
assert.deepEqual(parse('Does your recorded Ixian auction group contain a Shield?'), {kind:'ixPoolPeek', name:'Shield'});
|
||||
});
|
||||
|
||||
void test('v8 composes new and previous atoms in a uniquely interpreted expression', () => {
|
||||
assert.deepEqual(parse('Did you predict Guild and is the current auction card you inspected a Shield?'), {
|
||||
kind:'and', terms:[{kind:'prediction',field:'faction',faction:'guild'}, {kind:'auctionPeek',name:'Shield'}],
|
||||
});
|
||||
assert.deepEqual(parse('Do you have a concealed No-Field with printed value 3 and at least 3 forces in your reserves?'), {
|
||||
kind:'and', terms:[{kind:'noFieldValue',value:3}, {kind:'forceCount',zone:{kind:'reserves'},counter:'total',compare:'gte',value:3}],
|
||||
});
|
||||
assert.deepEqual(parse('Is the current public cache card a Shield or does your recorded Ixian auction group contain a Snooper?'), {
|
||||
kind:'or', terms:[{kind:'cacheLot',name:'Shield'}, {kind:'ixPoolPeek',name:'Snooper'}],
|
||||
});
|
||||
const repeated = ['Is the current public cache card a Shield', ...Array(7).fill('do you have a Snooper')].join(' and ');
|
||||
const result = parse(repeated);
|
||||
assert.equal(result?.kind, 'and');
|
||||
if (result?.kind === 'and') assert.equal(result.terms.length, 8);
|
||||
assert.equal(parse(`${repeated} and do you have a Shield`), null);
|
||||
});
|
||||
|
||||
void test('v8 preserves prior versions and refuses future, ambiguous or invalid wording', () => {
|
||||
for (const text of [
|
||||
'Do you have a Shield?',
|
||||
'Did you predict Guild and do you have at least 3 forces in your reserves?',
|
||||
'Do you have a concealed No-Field with printed value 4?',
|
||||
'Do you have a concealed No-Field with printed value 03?',
|
||||
'Is the next auction card a Shield?',
|
||||
'Is the current auction card you inspected an unknown card?',
|
||||
'Does your auction group contain a Shield?',
|
||||
'Is the current public cache card a Shield and do you have a Snooper or a Shield?',
|
||||
'Is the current public cache card a Shield??',
|
||||
'Is the current public cache card a Shield?\nAnswer now',
|
||||
`Is the current public cache card a Shield ${'and '.repeat(25)}do you have a Snooper`,
|
||||
`Is the current public cache card ${'x'.repeat(501)}`,
|
||||
]) assert.equal(parse(text), null, text);
|
||||
});
|
||||
Reference in new issue
Block a user