-2

Im creating a map for a python game, so that when an input of (Up,Down,Right,Left) are put in it will show a "map" of X's but it shows you as "A", but as you move, the X changes to a "E". So you know where you are in the game.

Tyler W
  • 9
  • 4

1 Answers1

0

Once you code into your program how to read the user's input, you can make a two-dimensional "map" with the following snippet. Here I iterate through ten positions for brevity:

>>> len = 10
>>> for n in range(0, len): print('x' * n + 'A' + 'x' * (len - n))
... 
Axxxxxxxxxx
xAxxxxxxxxx
xxAxxxxxxxx
xxxAxxxxxxx
xxxxAxxxxxx
xxxxxAxxxxx
xxxxxxAxxxx
xxxxxxxAxxx
xxxxxxxxAxx
xxxxxxxxxAx
>>>

It's then just a simple matter of variating the A through the use of a variable.

motoku
  • 1,571
  • 1
  • 21
  • 49