Initial scaffold: AI Tycoon monorepo with core game loop
Turborepo monorepo with three packages: - packages/shared: TypeScript types for all 14 game systems + balance constants + formatting utils - packages/game-engine: Pure TS simulation engine with tick processor, economy, infrastructure, compute, research, market, and reputation systems - apps/web: React + Vite + Tailwind + Zustand frontend with sidebar dashboard layout, new game screen, dashboard with charts, infrastructure management, and model training pages Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,24 @@
|
||||
import type { GameState, ComputeState, InfrastructureState } from '@ai-tycoon/shared';
|
||||
|
||||
export function processCompute(state: GameState, infrastructure: InfrastructureState): ComputeState {
|
||||
const totalFlops = infrastructure.totalFlops;
|
||||
const trainingAllocation = state.compute.trainingAllocation;
|
||||
const inferenceAllocation = 1 - trainingAllocation;
|
||||
|
||||
const inferenceFlops = totalFlops * inferenceAllocation;
|
||||
const tokensPerSecondCapacity = inferenceFlops * 10;
|
||||
|
||||
const tokensPerSecondDemand = state.compute.tokensPerSecondDemand;
|
||||
const inferenceUtilization = tokensPerSecondCapacity > 0
|
||||
? Math.min(1, tokensPerSecondDemand / tokensPerSecondCapacity)
|
||||
: 0;
|
||||
|
||||
return {
|
||||
totalFlops,
|
||||
trainingAllocation,
|
||||
inferenceAllocation,
|
||||
inferenceUtilization,
|
||||
tokensPerSecondCapacity,
|
||||
tokensPerSecondDemand,
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user