@@ -13,7 +13,9 @@ import AgentConfigData from './core/utilities/AgentConfig.json'
1313import { loadEvolutionConfig } from './core/utilities/loadConfig'
1414
1515export const App : React . FC = ( ) => {
16- const [ config , setConfig ] = useState < SimulationConfig > ( AgentConfigData as any as SimulationConfig )
16+ const [ config , setConfig ] = useState < SimulationConfig > (
17+ AgentConfigData as unknown as SimulationConfig
18+ )
1719 const [ isRunning , setIsRunning ] = useState ( true )
1820 const [ speed , setSpeed ] = useState ( 1 )
1921 const [ stats , setStats ] = useState < SimulationStats > ( {
@@ -32,8 +34,7 @@ export const App: React.FC = () => {
3234 const [ currentAgents , setCurrentAgents ] = useState < Agent [ ] > ( [ ] )
3335 const [ agentHistory , setAgentHistory ] = useState < Map < string , Agent > > ( new Map ( ) )
3436 const [ loadedAgents , setLoadedAgents ] = useState < Agent [ ] | null > ( null )
35- const [ showHelp , setShowHelp ] = useState ( false )
36- const [ evolutionConfig , setEvolutionConfig ] = useState < EvolutionConfig > ( loadEvolutionConfig ( ) )
37+ const [ evolutionConfig ] = useState < EvolutionConfig > ( loadEvolutionConfig ( ) )
3738 const [ placementMode , setPlacementMode ] = useState ( false )
3839 const [ pendingAgentTraits , setPendingAgentTraits ] = useState < GeneticTraits | null > ( null )
3940 const [ showAgentBuilder , setShowAgentBuilder ] = useState ( false )
@@ -42,7 +43,7 @@ export const App: React.FC = () => {
4243
4344 // Keyboard shortcuts
4445 React . useEffect ( ( ) => {
45- const handleKeyPress = ( e : KeyboardEvent ) => {
46+ const handleKeyPress = ( e : KeyboardEvent ) : void => {
4647 // Spacebar to pause/play
4748 if ( e . code === 'Space' && ! e . ctrlKey && ! e . metaKey && ! e . altKey ) {
4849 const target = e . target as HTMLElement
@@ -59,7 +60,7 @@ export const App: React.FC = () => {
5960 }
6061
6162 window . addEventListener ( 'keydown' , handleKeyPress )
62- return ( ) => window . removeEventListener ( 'keydown' , handleKeyPress )
63+ return ( ) : void => window . removeEventListener ( 'keydown' , handleKeyPress )
6364 } , [ selectedAgent ] )
6465
6566 const handleToggleRunning = useCallback ( ( ) => {
@@ -119,15 +120,18 @@ export const App: React.FC = () => {
119120 }
120121 } , [ ] )
121122
122- const handleAgentSelect = useCallback ( ( agent : Agent | null , screenPos ?: { x : number ; y : number } ) => {
123- if ( agent ) {
124- console . log (
125- `[App] Agent selected: ${ agent . id . substring ( 0 , 8 ) } , Species: ${ agent . species . substring ( 0 , 8 ) } `
126- )
127- setAgentScreenPos ( screenPos || null )
128- }
129- setSelectedAgent ( agent )
130- } , [ ] )
123+ const handleAgentSelect = useCallback (
124+ ( agent : Agent | null , screenPos ?: { x : number ; y : number } ) => {
125+ if ( agent ) {
126+ console . log (
127+ `[App] Agent selected: ${ agent . id . substring ( 0 , 8 ) } , Species: ${ agent . species . substring ( 0 , 8 ) } `
128+ )
129+ setAgentScreenPos ( screenPos || null )
130+ }
131+ setSelectedAgent ( agent )
132+ } ,
133+ [ ]
134+ )
131135
132136 const handleCloseDNA = useCallback ( ( ) => {
133137 setSelectedAgent ( null )
@@ -154,32 +158,33 @@ export const App: React.FC = () => {
154158 setResetKey ( ( prev ) => prev + 1 )
155159 } , [ ] )
156160
157- const handleEvolutionConfigChange = useCallback ( ( newConfig : EvolutionConfig ) => {
158- console . log ( '[App] Evolution config updated:' , newConfig )
159- setEvolutionConfig ( newConfig )
160- } , [ ] )
161-
162- const handleSpawnAgent = useCallback ( ( traits : GeneticTraits , multiPlace ?: boolean , speciesId ?: string ) => {
163- console . log ( '[App] Spawning custom agent with placement mode, multiPlace:' , multiPlace )
164- setPendingAgentTraits ( traits )
165- setPlacementMode ( true )
166- setMultiPlaceMode ( multiPlace || false )
167- setMultiPlaceSpeciesId ( speciesId || null )
168- setShowAgentBuilder ( false )
169- } , [ ] )
161+ const handleSpawnAgent = useCallback (
162+ ( traits : GeneticTraits , multiPlace ?: boolean , speciesId ?: string ) => {
163+ console . log ( '[App] Spawning custom agent with placement mode, multiPlace:' , multiPlace )
164+ setPendingAgentTraits ( traits )
165+ setPlacementMode ( true )
166+ setMultiPlaceMode ( multiPlace || false )
167+ setMultiPlaceSpeciesId ( speciesId || null )
168+ setShowAgentBuilder ( false )
169+ } ,
170+ [ ]
171+ )
170172
171- const handlePlacementComplete = useCallback ( ( newSpeciesId ?: string ) => {
172- console . log ( '[App] Agent placed successfully, multiPlaceMode:' , multiPlaceMode )
173- if ( multiPlaceMode ) {
174- if ( newSpeciesId && ! multiPlaceSpeciesId ) {
175- setMultiPlaceSpeciesId ( newSpeciesId )
173+ const handlePlacementComplete = useCallback (
174+ ( newSpeciesId ?: string ) => {
175+ console . log ( '[App] Agent placed successfully, multiPlaceMode:' , multiPlaceMode )
176+ if ( multiPlaceMode ) {
177+ if ( newSpeciesId && ! multiPlaceSpeciesId ) {
178+ setMultiPlaceSpeciesId ( newSpeciesId )
179+ }
180+ } else {
181+ setPlacementMode ( false )
182+ setPendingAgentTraits ( null )
183+ setMultiPlaceSpeciesId ( null )
176184 }
177- } else {
178- setPlacementMode ( false )
179- setPendingAgentTraits ( null )
180- setMultiPlaceSpeciesId ( null )
181- }
182- } , [ multiPlaceMode , multiPlaceSpeciesId ] )
185+ } ,
186+ [ multiPlaceMode , multiPlaceSpeciesId ]
187+ )
183188
184189 const handleCancelPlacement = useCallback ( ( ) => {
185190 console . log ( '[App] Placement cancelled' )
@@ -208,27 +213,38 @@ export const App: React.FC = () => {
208213 { /* Evolution Statistics */ }
209214 < div className = "sidebar-section evolution-stats" >
210215 < h3 className = "section-title" > Evolution</ h3 >
211- < div className = "stats-grid" style = { { gridTemplateColumns : 'repeat(4, 1fr)' , gap : '0.5rem' } } >
216+ < div
217+ className = "stats-grid"
218+ style = { { gridTemplateColumns : 'repeat(4, 1fr)' , gap : '0.5rem' } }
219+ >
212220 < div className = "stat" style = { { textAlign : 'center' } } >
213- < span className = "stat-label" style = { { fontSize : '0.6rem' } } > Gen</ span >
221+ < span className = "stat-label" style = { { fontSize : '0.6rem' } } >
222+ Gen
223+ </ span >
214224 < span className = "stat-value" style = { { color : '#00ff88' , fontSize : '1rem' } } >
215225 { stats . generation || 0 }
216226 </ span >
217227 </ div >
218228 < div className = "stat" style = { { textAlign : 'center' } } >
219- < span className = "stat-label" style = { { fontSize : '0.6rem' } } > Species</ span >
229+ < span className = "stat-label" style = { { fontSize : '0.6rem' } } >
230+ Species
231+ </ span >
220232 < span className = "stat-value" style = { { color : '#ff8800' , fontSize : '1rem' } } >
221233 { stats . speciesCount || 0 }
222234 </ span >
223235 </ div >
224236 < div className = "stat" style = { { textAlign : 'center' } } >
225- < span className = "stat-label" style = { { fontSize : '0.6rem' } } > Avg Fit</ span >
237+ < span className = "stat-label" style = { { fontSize : '0.6rem' } } >
238+ Avg Fit
239+ </ span >
226240 < span className = "stat-value" style = { { color : '#00ddff' , fontSize : '1rem' } } >
227241 { ( stats . avgFitness || 0 ) . toFixed ( 0 ) }
228242 </ span >
229243 </ div >
230244 < div className = "stat" style = { { textAlign : 'center' } } >
231- < span className = "stat-label" style = { { fontSize : '0.6rem' } } > Max Fit</ span >
245+ < span className = "stat-label" style = { { fontSize : '0.6rem' } } >
246+ Max Fit
247+ </ span >
232248 < span className = "stat-value" style = { { color : '#ff00ff' , fontSize : '1rem' } } >
233249 { ( stats . maxFitness || 0 ) . toFixed ( 0 ) }
234250 </ span >
@@ -249,13 +265,13 @@ export const App: React.FC = () => {
249265
250266 { /* Agent Builder Button */ }
251267 < div className = "sidebar-section" >
252- < button
268+ < button
253269 className = "btn-control"
254270 onClick = { ( ) => setShowAgentBuilder ( true ) }
255- style = { {
256- width : '100%' ,
257- display : 'flex' ,
258- alignItems : 'center' ,
271+ style = { {
272+ width : '100%' ,
273+ display : 'flex' ,
274+ alignItems : 'center' ,
259275 justifyContent : 'center' ,
260276 gap : '6px' ,
261277 padding : '8px'
@@ -267,7 +283,14 @@ export const App: React.FC = () => {
267283 </ div >
268284
269285 { /* Controls hint - compact */ }
270- < div className = "sidebar-footer" style = { { borderTop : '1px solid var(--border)' , paddingTop : '0.75rem' , marginTop : '0.5rem' } } >
286+ < div
287+ className = "sidebar-footer"
288+ style = { {
289+ borderTop : '1px solid var(--border)' ,
290+ paddingTop : '0.75rem' ,
291+ marginTop : '0.5rem'
292+ } }
293+ >
271294 < span style = { { color : '#666' , fontSize : '0.6rem' } } >
272295 Click agent for DNA | Scroll to zoom | R = trails | Space = pause
273296 </ span >
0 commit comments