Add Week 3 polish and late-game features

VC funding system (seed through IPO with requirements gating), 15
achievements with engine checker, model tuning presets and unlockable
sliders, overload policy controls, open-source mechanic with reputation
boost, enhanced Recharts analytics (subscriber/reputation/revenue vs
expenses charts), M&A acquisition system, sidebar NEW badges on era
transitions, tutorial hints, and wired-up settings toggles.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-04-24 17:56:40 -04:00
parent 8ea6c771a1
commit 8a8b49d934
20 changed files with 907 additions and 75 deletions
@@ -0,0 +1,43 @@
import type { GameState, FundingState, FundingRoundType } from '@ai-tycoon/shared';
import { FUNDING_ROUNDS } from '@ai-tycoon/shared';
const ROUND_ORDER: FundingRoundType[] = ['seed', 'seriesA', 'seriesB', 'seriesC', 'seriesD', 'ipo'];
export function getNextFundingRound(funding: FundingState): FundingRoundType | null {
if (funding.isPublic) return null;
const completedTypes = new Set(funding.completedRounds.map(r => r.type));
for (const type of ROUND_ORDER) {
if (!completedTypes.has(type)) return type;
}
return null;
}
export function canRaiseFunding(state: GameState): { canRaise: boolean; nextRound: FundingRoundType | null; reason?: string } {
const nextRound = getNextFundingRound(state.economy.funding);
if (!nextRound) return { canRaise: false, nextRound: null, reason: 'No more funding rounds available' };
const config = FUNDING_ROUNDS[nextRound];
const reqs = config.requirements;
if (reqs.minRevenue && state.economy.totalRevenue < reqs.minRevenue) {
return { canRaise: false, nextRound, reason: `Need $${reqs.minRevenue.toLocaleString()} total revenue` };
}
if (reqs.minUsers && state.market.consumers.totalSubscribers < reqs.minUsers) {
return { canRaise: false, nextRound, reason: `Need ${reqs.minUsers.toLocaleString()} subscribers` };
}
if (reqs.minReputation && state.reputation.score < reqs.minReputation) {
return { canRaise: false, nextRound, reason: `Need ${reqs.minReputation} reputation` };
}
return { canRaise: true, nextRound };
}
export function computeValuation(state: GameState): number {
const revenueMultiple = state.economy.revenuePerTick * 86400 * 365;
const subscriberValue = state.market.consumers.totalSubscribers * 500;
const capabilityValue = Math.pow(
Math.max(...state.models.trainedModels.map(m => m.benchmarkScore), 0),
2,
) * 1000;
return Math.max(100_000, revenueMultiple * 10 + subscriberValue + capabilityValue);
}