I am writing a chutes and ladders game for a class, and it's mostly working but I can't figure out how to make the chutes and ladders work.
Can I please have some hints?

board = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20,
         21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40,
         41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60,
         61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80,
         81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100]
for i in range (10):
    for j in range (10):
        print(board[-(i*10+j)-1], end = ' ')
    print()
print('\n\n')
#Ladders: 1-> 33(L1), 19- >75(L2), 69-> 85(L3)
#Snakes: 45 -> 15(S1), 82-> 48(S2), 98-< 78(S3)

board[1-1]='L1'
board[33-1]='L1'
board[19-1]='L2'
board[75-1]='L2'
board[69-1]='L3'
board[85-1]='L3'

board[45-1]='S1'
board[15-1]='S1'
board[82-1]='S2'
board[48-1]='S2'
board[98-1]='S3'
board[78-1]='S3'

for i in range (10):
    for j in range(10):
        print(board[-(i*10+j)-1], end=' ')
    print()
print('\n\n')

current = 0

#Roll dice
import random
while current != 100:
    # altered here, use a different name for input
    user = input("Press 'r' to roll the dice or 'e' to exit the program: ")
    # altered here also from
    # if roll == "r":
    if user == "r":
        # if you read input from the user and stored with the same name, the
        # original value will be erased
        roll = random.randrange(1,7)  
        current+= roll
        if current >100:
            current-=roll
        if current == 'S':
            snake_search = board[current+1: len(board)]
            if board[current][0] > snake_search:
                current == snake_search
        if current == 'L':
            ladder_search = board[current+1:len(board)]
            if board[current][0] < ladder_search:
                current == ladder_search
        last_number = current
        board[current-1]= 'X'     
        print ("You rolled a ", roll, "\n")
        for i in range (10):
            for j in range(10):
                print(board[-(i*10+j)-1], end=' ')
            print()
        print('\n\n')
        board[current-1] = last_number
        try:
            score = open("score.txt", "a")
            score.write(str(current))
            score.close()
        except:
            print('Warning, IOError. No such file exists. ')
    # exit 
    if user == "e":
        break

    # error
    if user != "r" and user != "e":
        print(roll)
        print("Incorrect input.")
#if roll hits 100, end game with "You Win"
if current == 100:
    print("You win!")
    score = open("score.txt", "r")
    print(score.readline(1))
    print(score.readline(2))
    print(score.readline(3))
    print(score.readline(4))
    print(score.readline(5))
    score.close()

For each snake, you should store the starting position and the ending position. If the user hits the starting position, then they 'teleport' to the ending position (ie, they go from the top to the bottom).
For each ladder, you should store the starting position and the ending position. If the user hits the starting position, then they 'teleport' to the ending position (ie, they go from the bottom to the top).
You could try storing these in a couple of arrays.
ie. "startingPositions" and "endingPositions", where the index of each array value in both arrays (ie. index of 2) corresponds to the same ladder/snake (ie. "startingPositions[2]" and "endingPositions[2]" correspond to ladder/snake number "2".
For the movement, you could simply change the players position to the top of the ladder.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.