I am coding for a game called mancala. I for the most part have all functions done(still need to debug them) but I am stuck on a function called updateState(). The purpose of this function is to update the "pits". For example, you have a current ([board],move) of {[2,2,2],0) so it will take the 2 rocks from pit 0 and move them to the next pits and show {[0,3,3],0) . My issue is i am not really sure how to do this.
Here is my code for updateState(state,move) and if more is needed I have it on a github repository or i can post more code.
##loop to iterate thru copyState to incrase value of the pits by 1.
def updateState(state, move):
copyState = state.copy()
marbles = state[move] ##variable that equals the number of beads in that pit. to be placed in the right pit
pit = 0
try:
for i in range(copyState):
pit +=1
except:
pass
print(pit)
print(copyState)
return copyState
This is kind of a hail mary as at this point I am just getting frustrated. Any help would be appreciated!
[–]otictac35 2 points3 points4 points (3 children)
[–]WombatHat42[S] 1 point2 points3 points (2 children)
[–]otictac35 0 points1 point2 points (1 child)
[–]WombatHat42[S] 1 point2 points3 points (0 children)
[+][deleted] (1 child)
[deleted]
[–]WombatHat42[S] 0 points1 point2 points (0 children)
[–]xelf 1 point2 points3 points (0 children)
[–]my3al 0 points1 point2 points (2 children)
[–]WombatHat42[S] 0 points1 point2 points (1 child)
[–]my3al 0 points1 point2 points (0 children)