Skip to content

Commit 33f3c7f

Browse files
committed
caesar_cipher: select before notify
1 parent 937134b commit 33f3c7f

File tree

1 file changed

+2
-3
lines changed
  • algorithm/cryptography/caesar_cipher/basic

1 file changed

+2
-3
lines changed

algorithm/cryptography/caesar_cipher/basic/code.js

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ function cipher(str, rotation, direction, cipherTracer) {
2626
var r = rotation;
2727

2828
logger._print('Rotating ' + currChar + ' ' + direction + ' ' + rotation + ' times');
29-
cipherTracer._notify(i)._wait();
29+
cipherTracer._select(i)._wait();
3030

3131
// perform given amount of rotations in the given direction
3232
while (r-- > 0) {
@@ -37,8 +37,7 @@ function cipher(str, rotation, direction, cipherTracer) {
3737
str = str.substring(0, i) + currChar + str.substring(i + 1);
3838
logger._print('Current result: ' + str);
3939
}
40-
41-
cipherTracer._select(0, i);
40+
4241
return str;
4342
}
4443

0 commit comments

Comments
 (0)