File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -10,26 +10,30 @@ class Program
1010 {
1111 static void Main ( string [ ] args )
1212 {
13+ bool showCellInfo = true ;
1314 CellOverseer overseer = new CellOverseer ( 1 ) ;
1415 while ( true )
1516 {
16- foreach ( Cell cell in overseer . cells )
17+ if ( showCellInfo )
1718 {
18- Console . WriteLine ( "ID:" + cell . id + "|AGE:" + cell . age + "|FOOD:" + cell . food + "|ENERGY:" + cell . energy + "|ACTION:" + cell . lastAction ) ;
19+ foreach ( Cell cell in overseer . cells )
20+ {
21+ Console . WriteLine ( "ID:" + cell . id + "|AGE:" + cell . age + "|FOOD:" + cell . food + "|ENERGY:" + cell . energy + "|ACTION:" + cell . lastAction ) ;
22+ }
1923 }
2024 Console . WriteLine ( "ALIVE:" + overseer . cells . Count ( ) ) ;
21- string keyPressed = Console . ReadLine ( ) ;
22- if ( keyPressed != "" )
25+ string commandEntered = Console . ReadLine ( ) . ToLower ( ) ;
26+ if ( commandEntered != "" )
2327 {
24- if ( keyPressed == "save" )
28+ if ( commandEntered == "save" )
2529 {
2630 overseer . SaveToFile ( ) ;
2731 continue ;
2832 }
29- else if ( keyPressed == "load" )
33+ else if ( commandEntered == "load" )
3034 {
3135 string fileName = Console . ReadLine ( ) ;
32- if ( fileName == "" )
36+ if ( fileName == "" )
3337 {
3438 continue ;
3539 }
@@ -38,6 +42,10 @@ static void Main(string[] args)
3842 overseer . LoadFromFile ( fileName ) ;
3943 }
4044 }
45+ else if ( commandEntered == "switchshowinfo" )
46+ {
47+ showCellInfo = ! showCellInfo ;
48+ }
4149 }
4250
4351 overseer . SimulateNext ( ) ;
You can’t perform that action at this time.
0 commit comments