File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -8,7 +8,7 @@ namespace CellSimulator.Interfaces
88{
99 public interface ICellOverseer
1010 {
11- List < ICell > CellList { get ; }
11+ List < ICell > CellList { get ; set ; }
1212
1313 void AddCell ( ) ;
1414 void AddCell ( ICell cell ) ;
Original file line number Diff line number Diff line change 66using CellSimulator . Interfaces ;
77using CellSimulator . Input ;
88using CellSimulator . Enums ;
9+ using CellSimulator . Output ;
910
1011namespace CellSimulator . Logic
1112{
1213 public class SimulationManager : ISimulationManager
1314 {
14- private readonly CellOverseer Overseer = new CellOverseer ( ) ;
15- private readonly SaveLoadManager SaveLoadmanager = new SaveLoadManager ( ) ;
16- private readonly ConsoleInputManager InputManager = new ConsoleInputManager ( ) ;
15+ private readonly ICellOverseer Overseer = new CellOverseer ( ) ;
16+ private readonly ISaveLoadManager SaveLoadmanager = new SaveLoadManager ( ) ;
17+ private readonly IUserActionManager InputManager = new ConsoleInputManager ( ) ;
18+ private readonly ICellPrinter OutputManager = new ConsoleCellPrinter ( ) ;
1719
1820 public void StartSimulation ( )
1921 {
2022 SetInitialPopulation ( ) ;
2123 while ( true )
2224 {
25+ OutputManager . PrintCells ( Overseer . CellList ) ;
2326 switch ( InputManager . GetUserAction ( ) )
2427 {
2528 case UserActionEnum . LOAD :
@@ -40,7 +43,7 @@ public void StartSimulation()
4043 private void SetInitialPopulation ( )
4144 {
4245 int cellCount = GetStartingCellCount ( ) ;
43- for ( int i = 0 ; i < cellCount ; ++ i )
46+ for ( int i = 0 ; i < cellCount ; ++ i )
4447 {
4548 Overseer . AddCell ( ) ;
4649 }
Original file line number Diff line number Diff line change @@ -12,10 +12,10 @@ public class Cell : ICell
1212 {
1313 public int ID { get ; set ; }
1414 public int Age { get ; set ; }
15- public int Food { get ; set ; }
16- public int MaxFood { get ; set ; }
17- public int Energy { get ; set ; }
18- public int MaxEnergy { get ; set ; }
15+ public int Food { get ; set ; } = 100 ;
16+ public int MaxFood { get ; set ; } = 100 ;
17+ public int Energy { get ; set ; } = 100 ;
18+ public int MaxEnergy { get ; set ; } = 100 ;
1919 public CellActionEnum LastAction { get ; set ; }
2020 public bool IsAlive { get ; set ; } = true ;
2121
Original file line number Diff line number Diff line change @@ -17,11 +17,11 @@ public void PrintCells(IEnumerable<ICell> cellsToPrint)
1717 {
1818 Console . WriteLine ( string . Join ( VALUE_SEPARATION_VALUE . ToString ( ) ,
1919 new string [ ] {
20- $ "{ nameof ( cell . ID ) } :{ cell . ID } " +
21- $ "{ nameof ( cell . Age ) } :{ cell . Age } " +
22- $ "{ nameof ( cell . Food ) } :{ cell . Food } " +
23- $ "{ nameof ( cell . Energy ) } :{ cell . Energy } " +
24- $ "{ nameof ( cell . LastAction ) } :{ cell . LastAction } "
20+ $ "{ nameof ( cell . ID ) } :{ cell . ID } ",
21+ $ "{ nameof ( cell . Age ) } :{ cell . Age } ",
22+ $ "{ nameof ( cell . Food ) } :{ cell . Food } ",
23+ $ "{ nameof ( cell . Energy ) } :{ cell . Energy } ",
24+ $ "{ nameof ( cell . LastAction ) } :{ cell . LastAction } ",
2525 } ) ) ;
2626 }
2727 }
Original file line number Diff line number Diff line change 33using System . Linq ;
44using System . Text ;
55using System . Threading . Tasks ;
6+ using CellSimulator . Logic ;
67
78namespace CellSimulator
89{
910 class Program
1011 {
1112 static void Main ( string [ ] args )
1213 {
14+ SimulationManager manager = new SimulationManager ( ) ;
15+ manager . StartSimulation ( ) ;
16+ return ;
17+
1318 bool showCellInfo = true ;
1419 CellOverseer overseer = new CellOverseer ( 1 ) ;
1520 while ( true )
You can’t perform that action at this time.
0 commit comments