# ---
# jupyter:
#   jupytext:
#     text_representation:
#       extension: .py
#       format_name: light
#       format_version: '1.5'
#       jupytext_version: 1.14.4
#   kernelspec:
#     display_name: Python 3 (ipykernel)
#     language: python
#     name: python3
# ---

# +
#Part1
#Player1_st=4-1
#Player2_st=8-1
Player1_st=8-1
Player2_st=6-1

def rolling_last(player_pos, roll_last, total_score):
    roll_last1=roll_last+1
    if roll_last1>100:
        roll_last1=roll_last1-100
    #print('roll_last1',roll_last1)
    roll_last2=roll_last1+1
    if roll_last2>100:
        roll_last2=roll_last2-100
    #print('roll_last2',roll_last2)
    roll_last3=roll_last2+1
    if roll_last3>100:
        roll_last3=roll_last3-100
    #print('roll_last3:',roll_last3)
    player_pos+=roll_last1+roll_last2+roll_last3
    
    while player_pos >=10:
        player_pos=player_pos-10
    total_score = total_score+ player_pos+1
    
    return(player_pos, roll_last3,total_score )
    
  

die=0
total_score1 = 0
total_score2 = 0
game=True    
roll_last=0
while game==True:
    (Player1_st,  roll_last, total_score1) =  rolling_last(Player1_st, roll_last, total_score1)
    #print( 'Player_pos after roll for next step:', Player1_st, 'last roll:', roll_last, 'total_score of first player: ', total_score1)
    die+=3
    if total_score1>=1000:
        res=total_score2*(die)
        game=False
    (Player2_st,  roll_last, total_score2) =  rolling_last(Player2_st, roll_last, total_score2)
    #print(Player2_st, roll_last, total_score2)
    die+=3
    if total_score2>=1000:
        res=total_score1*(die)
        game=False

print(res)
    

# -



StarcoderdataJupyterScriptsDedupFiltered