Skip to content

Commit 6579a36

Browse files
Update program.c
1 parent 3d58e27 commit 6579a36

1 file changed

Lines changed: 15 additions & 7 deletions

File tree

  • programs/2016/C/01-No_Time_for_a_Taxicab

programs/2016/C/01-No_Time_for_a_Taxicab/program.c

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@ typedef struct Instruction {
1818

1919
// todo: describe here
2020
typedef struct Position {
21-
int x ;
22-
int y ;
21+
int x ;
22+
int y ;
2323
char facingDirection ; // 'N', 'E', 'S', 'W'
2424

2525
} Position ;
@@ -166,18 +166,26 @@ int main() {
166166
const int orderLength = loopCounter ;
167167

168168
// Direction:
169-
int directionMapping[256] = {0} ; // We set a table large enough that contains all ASCII usual letters.
170-
directionMapping['N'] = 1 ;
171-
directionMapping['E'] = 2 ;
172-
directionMapping['S'] = 3 ;
173-
directionMapping['W'] = 4 ;
169+
int directionMapping_char[256] = {0} ; // We set a table large enough that contains all ASCII usual letters.
170+
directionMapping_char['N'] = 1 ;
171+
directionMapping_char['E'] = 2 ;
172+
directionMapping_char['S'] = 3 ;
173+
directionMapping_char['W'] = 4 ;
174+
175+
char directionMapping_int[5] = {0} ;
176+
directionMapping_int[1] = 'N' ;
177+
directionMapping_int[2] = 'E' ;
178+
directionMapping_int[3] = 'S' ;
179+
directionMapping_int[4] = 'W' ;
180+
174181

175182

176183

177184
for(i=0; i<orderLength; i++){
178185
// 1. Pole facing update
179186

180187

188+
181189
// 2. Distance calculation
182190
}
183191

0 commit comments

Comments
 (0)