@@ -26,8 +26,8 @@ public void Execute()
2626 var map = LoadMap ( ) ;
2727 Log ( String . Format ( "Map:{0}{1}" , Environment . NewLine , map ) ) ;
2828
29- var move = GetRandomMove ( ) ;
30- SaveMove ( move ) ;
29+ var shipCommand = GetRandomShipCommand ( ) ;
30+ SaveShipCommand ( shipCommand ) ;
3131 }
3232
3333 private Match LoadState ( )
@@ -101,28 +101,29 @@ private string LoadMap()
101101 }
102102 }
103103
104- private string GetRandomMove ( )
104+ private ShipCommand GetRandomShipCommand ( )
105105 {
106106 var random = new Random ( ) ;
107- var possibleMoves = Enum . GetValues ( typeof ( ShipCommand ) ) ;
108- return possibleMoves . GetValue ( random . Next ( 0 , possibleMoves . Length ) ) . ToString ( ) ;
107+ var possibleShipCommands = Enum . GetValues ( typeof ( ShipCommand ) ) ;
108+ return ( ShipCommand ) possibleShipCommands . GetValue ( random . Next ( 0 , possibleShipCommands . Length ) ) ;
109109 }
110110
111- private void SaveMove ( string move )
111+ private void SaveShipCommand ( ShipCommand shipCommand )
112112 {
113+ var shipCommandString = shipCommand . ToString ( ) ;
113114 var filename = Path . Combine ( OutputPath , Settings . Default . OutputFile ) ;
114115 try
115116 {
116117 using ( var file = new StreamWriter ( filename ) )
117118 {
118- file . WriteLine ( move ) ;
119+ file . WriteLine ( shipCommandString ) ;
119120 }
120121
121- Log ( "Move : " + move ) ;
122+ Log ( "Command : " + shipCommandString ) ;
122123 }
123124 catch ( IOException e )
124125 {
125- Log ( String . Format ( "Unable to write move file: {0}" , filename ) ) ;
126+ Log ( String . Format ( "Unable to write command file: {0}" , filename ) ) ;
126127
127128 var trace = new StackTrace ( e ) ;
128129 Log ( String . Format ( "Stacktrace: {0}" , trace ) ) ;
0 commit comments