#๐Ÿ”’ Unable to get expected output

37 messages ยท Page 1 of 1 (latest)

undone gullBOT
#

@hot fractal

Python help channel opened

Remember to:

  • Ask your Python question, not if you can ask or if there's an expert who can help.
  • Show a code sample as text (rather than a screenshot) and the error message, if you've got one.
  • Explain what you expect to happen and what actually happens.

:warning: Do not pip install anything that isn't related to your question, especially if asked to over DMs.

hot fractal
#

heres my code

#

The game is basically your usual snakes and ladders game. The first part runs automatically and the second part is an exclusively 2 player turn by turn version. You can choose how many players you want for the first part (1 to 4 players). And it will run itself (by rolling dices) until one of the players (bots) reach 100. There are of course, the snakes and the ladders, and also in this game, there are special tiles, which also have their own dice roll performed (3 sided dice: 0 (means a reroll), 1 (next player skips a turn), 2 (all other players minus 5 steps). The code looks fine but I dont know why it doesnt pass the test cases (from the practice website)

#

first test case:

#

second test case:

leaden token
#

There might be some logic error lemme take a look at your code Iโ€™ll be back

hot fractal
#

ok thanks man ๐Ÿ™

leaden token
#

Your code lgtm , do you have access to the test files ?

mild zealot
hot fractal
#

HAHAH HI WONG

mild zealot
#

hi hahahaha

#

it's definitely a logic error but i also have a logic error

hot fractal
mild zealot
#

bro came prepared

#

jahahahahahah

hot fractal
#

yesssir

leaden token
#

i looked at your special roll and roll dice function

#

looks like you didn't use randit function correctly

#

randit() include both numbers you put as input

#

if you want to generate numbers between [0,2] and [1,6] it should be :


import numpy as np


def roll_the_dice():
    return np.random.randint(1, 6) # instead of (1, 7)

def special_roll():
    return np.random.randint(0, 2) # instead of (0, 3) ```
mild zealot
#

no u cant change that

#

for the assignment we are not supposed to do that

leaden token
#

Ooh

#

i see , i was just thinking and even if it was possible it wouldn't work

#

cuz the seed take control

mild zealot
#

yes

mild zealot
#

so do you think u can tell what would the problem be

leaden token
#

there's many possible case, but looking at the log it implies that your code is not respecting the rules of the game

#

logic bugs are the most frustrating ngl

#

i went through almost every line , can't find what's wrong

leaden token
#

one thing also , your game is supposed to end when one of the player reach tile 100

#

(the while loop)

#

but in the test cases your outputs shows that your games are ending before anyone could win

undone gullBOT
#
Python help channel closed

This help channel has been closed and it's no longer possible to send messages here. If your question wasn't answered, feel free to create a new post in #1035199133436354600. To maximize your chances of getting a response, check out this guide on asking good questions.