#๐ Unable to get expected output
37 messages ยท Page 1 of 1 (latest)
@hot fractal
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.
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:
There might be some logic error lemme take a look at your code Iโll be back
ok thanks man ๐
Your code lgtm , do you have access to the test files ?
https://paste.pythondiscord.com/6WUQ
this is the test case
HAHAH HI WONG
also these are the functions for rolling the dices: https://paste.pythondiscord.com/VGWQ and generating special tiles: https://paste.pythondiscord.com/DDDA
yesssir
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) ```
Ooh
i see , i was just thinking and even if it was possible it wouldn't work
cuz the seed take control
yes
so do you think u can tell what would the problem be
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
your outputs are off by 1 or 2 in this test case , it could be that your counting doesn't add up somewhere
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
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.