Python Forum
snakes and ladders board creation help
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
snakes and ladders board creation help
#1
I have made a simple snakes and ladders game where the dice is rolled automatic and and the end tells you the winner. I would like to display the result of each move on a board / grid from 1 to 49 but have no idea on how to go about doing this below is my code and i am open to all suggestions that are not to complicated. Think

import time
from random import randint
print("Welcome to my game please input the players names")
player1=input("Please enter player 1's name followed by the return key : ")
player2=input("Please enter player 2's name followed by the return key : ")
print("right then ", player1," and ",player2, " the game is simple i'll explain the rules as we go along")
player1position=1
player2position=1
while player1position<48 or player2position<48:
    print("Its" , player1 , "' go ")
    dice1=randint(0,6)
    dice2=randint(0,6)
    if dice1==dice2:
        print("both dices rolled a ", dice1, " so you move back ", dice1+dice2 ," spaces")
        player1position=player1position-dice1+dice2
    else:
        print("Your first dice was a ", dice1, " and your second was a ", dice2)
        print("your total is ", dice1+dice2)
        player1position=player1position+dice1+dice2
        print("player one is now on square ", player1position)
        time.sleep(0.1)
    print("Its" , player2 , "' go ")
    dice1=randint(0,6)
    dice2=randint(0,6)
    if dice1==dice2:
        print("both dices rolled a ", dice1, " so you move back " ,dice1+dice2 ," spaces")
        player2position=player2position-dice1+dice2
    print("Your first dice was a ", dice1, " and your second was a ", dice2)
    print("your total is ", dice1+dice2)
    player2position=player2position+dice1+dice2
    print("player two is now on square ", player2position)
    time.sleep(0.1)
else:
    if player1position >49:
        print(player1 , "has won well done")
    else:
        print(player2 , "has won well done")
Reply


Messages In This Thread
snakes and ladders board creation help - by teddyben123 - Aug-25-2017, 11:35 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Trying to make a board with turtle, nothing happens when running script Quascia 3 712 Nov-01-2023, 03:11 PM
Last Post: deanhystad
Photo HOW FIX MY BOARD GAME LAZABI 3 1,501 Apr-01-2022, 04:23 PM
Last Post: BashBedlam
  The game should now run and terminate once the board is full, but still can’t identif rango 0 1,473 Jul-22-2021, 03:24 AM
Last Post: rango
  Enabling interrupt on Adafruits button/led board Moris526 0 2,036 Apr-30-2021, 03:29 PM
Last Post: Moris526
  High-Precision Board Voltage Reading from Python into PD Liam484 1 2,106 Mar-29-2021, 02:57 PM
Last Post: Marbelous
  Interrupt for Adafruits Neotrellis button/led board Moris526 0 1,826 Dec-28-2020, 05:42 AM
Last Post: Moris526
  [Help] A function that generates an n x n sized board? vanicci 5 4,808 Aug-14-2018, 02:26 PM
Last Post: vanicci
  Serial communication with a board Bokka 2 5,387 Dec-07-2017, 07:34 AM
Last Post: Bokka
  Communicating C++ and Python in Jetson TK1 board. hlfan1234567 1 3,203 Jul-09-2017, 04:22 PM
Last Post: hlfan1234567

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020