feat(tongji): add milk tea afternoon challenge
This commit is contained in:
@@ -16,6 +16,7 @@ const FOOD_GROUPS = [
|
||||
{ title: '粗粮早餐', safe: ['broccoli', 'milk', 'brownRice', 'potato'], danger: 'milletCongee' },
|
||||
{ title: '水果饮品', safe: ['apple', 'strawberry', 'banana', 'mango'], danger: 'orangeJuice' },
|
||||
{ title: '日常饮品', safe: ['milk', 'tea', 'blackCoffee', 'coffee'], danger: 'soda' },
|
||||
{ title: '下午茶甜饮', safe: ['milk', 'tea', 'apple', 'strawberry'], danger: 'milkTea' },
|
||||
{ title: '南方汤粉', safe: ['pepper', 'greenBean', 'shrimp', 'udon'], danger: 'riceNoodleSoup' },
|
||||
{ title: '北方面食', safe: ['onion', 'celery', 'corn', 'grainMantou'], danger: 'noodleSoup' },
|
||||
{ title: '家常餐桌', safe: ['tofu', 'spinach', 'carrot', 'fish'], danger: 'redBeanCongee' }
|
||||
@@ -423,6 +424,12 @@ function createMetrics() {
|
||||
function runTargetedTailTests(metrics) {
|
||||
for (let groupIndex = 0; groupIndex < FOOD_GROUPS.length; groupIndex += 1) {
|
||||
const nextIndex = (groupIndex + 1) % FOOD_GROUPS.length
|
||||
const previousGroup = FOOD_GROUPS[groupIndex]
|
||||
const nextGroup = FOOD_GROUPS[nextIndex]
|
||||
// 相邻主题允许在相同槽位保留同一种食物。定向测试应选择真正退出下一组的食物,
|
||||
// 不能固定测试第 0 槽,否则“牛奶→牛奶”会被误报为尾巴未转换。
|
||||
const slot = previousGroup.safe.findIndex(key => !nextGroup.safe.includes(key))
|
||||
if (slot < 0) continue
|
||||
for (const remaining of [0, 1, 2]) {
|
||||
const state = {
|
||||
run: -1,
|
||||
@@ -430,21 +437,21 @@ function runTargetedTailTests(metrics) {
|
||||
rng: createRng(BASE_SEED + groupIndex * 17 + remaining),
|
||||
metrics,
|
||||
themeIndex: nextIndex,
|
||||
activeSafeKeys: [...FOOD_GROUPS[nextIndex].safe],
|
||||
activeSafeKeys: [...nextGroup.safe],
|
||||
transition: {
|
||||
from: FOOD_GROUPS[groupIndex].safe[0],
|
||||
to: FOOD_GROUPS[nextIndex].safe[0],
|
||||
slot: 0,
|
||||
from: previousGroup.safe[slot],
|
||||
to: nextGroup.safe[slot],
|
||||
slot,
|
||||
age: 0
|
||||
},
|
||||
queuedSafeGroups: [[...FOOD_GROUPS[nextIndex].safe]],
|
||||
queuedSafeGroups: [[...nextGroup.safe]],
|
||||
board: []
|
||||
}
|
||||
const fill = FOOD_GROUPS[nextIndex].safe
|
||||
const fill = nextGroup.safe
|
||||
state.board = Array.from({ length: ROWS * COLS }, (_, index) => tile(fill[index % fill.length]))
|
||||
for (let index = 0; index < remaining; index += 1) state.board[index] = tile(state.transition.from)
|
||||
finishTransitionIfReady(state)
|
||||
if (state.board.some(item => item.key === FOOD_GROUPS[groupIndex].safe[0])) {
|
||||
if (state.board.some(item => item.key === state.transition?.from || item.key === previousGroup.safe[slot])) {
|
||||
recordFailure(state, 'targeted_tail_not_converted', `${groupIndex}:${remaining}`)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,7 +7,8 @@ const FOOD_ICON_FILES = [
|
||||
'spinach.jpg',
|
||||
'carrot.jpg',
|
||||
'fish.jpg',
|
||||
'redBeanCongee.jpg'
|
||||
'redBeanCongee.jpg',
|
||||
'milkTea.jpg'
|
||||
]
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user