I need to move in a zigzag (like snakes and ladders) from the start to the end of the grid.
Here's my code so far:
Here's my code so far:
import random
def cls():
print("\n" * 100)
# clears screen
def create_grid():
# create a 2d array with the specified dimensions & contents called 3 times to create the 3 game tables
grid = []
for x in range(7):
grid.append([])
for y in range(7):
grid[x].append(" ")
for i in range(7):
a = i + 1
b = 14 - i
c = 15 + i
d = 28 - i
e = 29 + i
f = 42 - i
g = 43 + i
string1 = str(a)
string2 = "0" + string1
grid[6][i] = string2
grid[5][i] = str(b)
grid[5][6] = "08"
grid[5][5] = "09"
grid[4][i] = str(c)
grid[3][i] = str(d)
grid[2][i] = str(e)
grid[1][i] = str(f)
grid[0][i] = str(g)
return grid
print(create_grid())
def roll_dice():
roll_one = random.randint(1, 6)
roll_two = random.randint(1, 6)
return roll_one, roll_two
def move_counter():
move = 0
return move
def starter_position():
p1_x_current = 0
p1_y_current = 6
p1_x_previous = 0
p1_y_previous = 6
p2_x_current = 0
p2_y_current = 6
p2_x_previous = 0
p2_y_previous = 6
return p1_x_current, p1_y_current, p1_x_previous, p1_y_previous, p2_x_current, p2_y_current, p2_x_previous, p2_y_previous
def movement(move, p1_x_current, p1_y_current, p1_x_previous, p1_y_previous, p2_x_current, p2_y_current, p2_x_previous, p2_y_previous):
dice_roll = roll_dice()
move
position
def print_grid(grid):
print("-" * (7 * 4))
for y in range(0, 7):
print("|" + "|".join(grid[y]) + "|")
print("-" * (7 * 4))
grid[6][0] = ' p'
print(print_grid(create_grid()))
