Permalink
Browse files

Print separate characters instead of whole line

  • Loading branch information...
1 parent 73dcd1b commit 2d7a4d73cc79abf06ab34dc915b20d6fdf3ce514 @jtwaleson committed Aug 11, 2012
Showing with 12 additions and 9 deletions.
  1. +12 −9 decrypt.py
View
21 decrypt.py
@@ -47,15 +47,18 @@ def iterate(increase = False):
first_line = 0
for line_num in range(first_line, final_line):
line = lines[line_num]
- for i in [i for i in range(min(x, len(line))) if i not in confirmed_per_line[line_num]]:
- still_random += 1
- if random.random() < chance:
- confirmed_per_line[line_num].append(i)
- random_line = ''.join(random.choice(string.punctuation) if col not in confirmed_per_line[line_num] else line[col] for col in range(min(len(line), x)))
- try:
- screen.addstr(line_num - first_line, 0, random_line)
- except:
- pass
+ for i in [i for i in range(min(x, len(line)))]:
+ if i not in confirmed_per_line[line_num]:
+ still_random += 1
+ if random.random() < chance:
+ confirmed_per_line[line_num].append(i)
+ char = random.choice(string.punctuation)
+ else:
+ char = line[i]
+ try:
+ screen.addch(line_num - first_line, i, char)
+ except:
+ pass
screen.refresh()
time.sleep(0.1)

0 comments on commit 2d7a4d7

Please sign in to comment.