Click here to Skip to main content
15,892,298 members

Comments by DosNecro (Top 8 by date)

DosNecro 29-Mar-24 13:34pm View    
My mistake, I updated the question now. I was able to get the player movement and initialization to work. However, the car movement that is supposed to happen on every player movement is not working.
DosNecro 29-Mar-24 5:49am View    
I updated the question with a few changes I made to the movePlayer function. However, the game logic is executing without errors, but the expected changes (movement of the player or updates to the game grid) aren't visually reflected on the terminal.
DosNecro 28-Mar-24 7:29am View    
10 15
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 3 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 1 1 1 1 0 0 0 1 1 1 1 0 0
0 0 1 0 0 1 0 0 0 1 0 0 1 0 0
0 0 1 0 0 1 1 1 1 1 1 1 1 0 0
0 0 1 0 0 0 0 0 0 1 0 0 0 0 0
0 0 1 0 0 0 0 0 4 1 0 0 0 0 0
0 0 1 1 1 1 1 2 1 1 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0

the first line represents the dimensions of the grid (rows and columns)
1 represents the road (path the car will take)
2 represents the car
3 for the player
4 for the goal
DosNecro 21-Feb-24 4:44am View    
I tried implementing this, however, now every time the player moves, a player (P) is printed on the previous position the player was in.
DosNecro 21-Feb-24 4:41am View    
I tried implementing this. However, this time, every time the player moves, a road ('.') is printed on the grid of the previous position of the player.