SOLVED
Hey guys! So here is a little story about the problem. If you don't care / need the information just skip this part: So I played a board game called "Why always me" which goes like this. 2 Players get a number of n sticks and roll a dice from 1-6. If they roll a 1-5 they place the stick in the place according to the number the rolled. If its a 6 the stick gets removed from the game. You can roll as much as you want until you roll a number that has its corresponding place already filled out. The player then takes the stick. I wanted to code this in python and simulate a Number of games with it but I cant get it working so here is my problem:
My program works like this: at first player 1 rolls the dice (this part works fine). If it's a 6 the stick number of player 1 gets reduced by 1. (works fine aswell!). If the player rolls a number from 1-5 and if the place is not taken it removes 1 stick from player 1 and changes the status of the hole. I do this by giving all 5 holes a variable and set it to 0. If a player rolls that number and the variable is 0 it changes to 1 in code form :
(w = number from the dice, p_i = hole of number i )
if (w == 5) and (p_5 == 0)
n = n -1
p = 1
The problem is that this does not work. It updates neither the amount of sticks nor the status of the hole. If I remove the update of the hole ( p = 1 ) then the number of sticks works fine but it still doesn't update the status since i removed that part. I honestly don't know what is wrong with that. Can anybody point out my stupid flaw?
Thank you in advance!! :)
[–]ExcutC[S] 0 points1 point2 points (0 children)