# Challenge Atlas Game in Python [closed]

Here is my code:

https://gist.github.com/Salil03/5fb4d512b97324c89e2580f94725a7fd

The instructions are printed out from the python file.

They are given here for convienience

1. You start by typing in a letter

2. The computer then types another letter and the cycle repeats Example: You type: z Computer types: a

4. So the next letter you type must me ""m"" or ""i"". But, you must type" """m"" because the last letter of zambia will end on the computer." On the other hand, last letter of zaire will end on you.

5. The person on which the last letter ends, loses. Example: Computer loses on sweden You lose on dubai

6. If you don't know any place you can type in ""Challenge""." The computer will give you the answer and you will lose.

7. If the computer doesn't know the answer, he will say ""Challenge""" Then two things can happen:

1) You know the right answer and the moderator says it is correct and you win.

or

2) You don't know the right answer and you type in gibberish and the moderator marks it as wrong and you lose

1. Whenever you think the computer has typed in the last letter of a place, press enter.

1. coding style
2. performance

## closed as off-topic by vnp, Stephen Rauch, Malachi♦Jul 10 '18 at 18:26

This question appears to be off-topic. The users who voted to close gave this specific reason:

• "Authorship of code: Since Code Review is a community where programmers improve their skills through peer review, we require that the code be posted by an author or maintainer of the code, that the code be embedded directly, and that the poster know why the code is written the way it is." – vnp, Stephen Rauch, Malachi
If this question can be reworded to fit the rules in the help center, please edit the question.

• Welcome to Code Review. Can you include your code also? It is expected for reviews here. codereview.stackexchange.com/help/how-to-ask – chicks Jul 10 '18 at 17:32
• @chicks The code is big so I included a link for it – Agile_Eagle Jul 10 '18 at 17:33
• Welcome to Code Review! Unfortunately your question is off-topic as of now, as the code to be reviewed must be present in the question. Please add the code you want reviewed in your question. Thanks! – Malachi Jul 10 '18 at 18:26
• @Malachi the formatting of the code gets disturbed if I add it in the question – Agile_Eagle Jul 10 '18 at 18:27
• @Agile_Eagle: We can attempt to fix it in that case. – Jamal Aug 13 '18 at 23:30

By far the most important thing you can change is splitting your code up into smaller functions. For example, every time you print with random colors, that could be a function:

def print_colored(str, n=1):
for i, x in enumerate(str):
if i % n == 0:
print(x, end='')
sys.stdout.flush()
os.system("color " + str(randint(1, 8)))
else:
print(x, end='')
sys.stdout.flush()