dice - 2 Functions executing side by side -


OK, this is the first time that I'm asking a question here, please do not be crazy if this is not a good question is. I have 6 functions which are rolling a dice. I have to make craps games for programming, this game is fully implementing, but I have been opposed to each other, as opposed to each other. For example:

  I have it: + ------ + | * | | * | + ====== + ------ + | * | | * | + ------ + I need it: + ------ + + ------ + | * | | * | | * | | * | + ------ + + ------ + This is my program yet: import random DEF roll_des1 (): print "+ ------- +" print "| |" Print "| * |" Print "| |" Print "+ ------- +" def roll_division2 (): print "+ ------- +" print "| * |" | Print "| |" Print "| * |" Print "+ ------- +" def roll_disease 3 (): print "+ ------- +" print "| * |" | Print "| * |" Print "| * |" Print "+ ------- +" def roll_dis4 (): print "+ ------- +" print "| * * |" Print "| |" Print "| * * |" Print "+ ------- +" def roll_evice5 (): print "+ ------- +" print "| * * |" Print "| * |" Print "| * * |" Print "+ ------- +" def roll_device6 (): print "+ ------- +" print "| * * * |" Print "| |" Print "| * * *" Print "+ ------- +" def dice_roll (): Counter = 0 Dice = [] while the Counter & lt; Int (2): Dice + = [Random. Rendent (1,6)] Counter + = 1 I = 0 while I & lt; 2: If dice [i] == 1: roll_division1 () alif pase [i] == 2: roll_device2 () alif dice [i] == 3: roll_divis3 () elif pase [i] == 4: Roll_dis4 () Elif dice [i] == 5: roll_dice5 () elif dice [i] == 6: roll_dice6 () i + = 1 roll = dias return roll def point_cycle (): raw_input ("Rolling Dice Press "lt; enter & gt;") roll = dice_roll () total1 = int (roll [0]) + int (roll [1]) if total 1 == 7: print "you rolled a 7." print " You lost! " Elife Total 1 == Total: Print "You Rolled" + str (Total 1) Print "You Win!" Else: Print "You" a "+ str (total 1) point_cycle () def (main): print" craps: A popular dice game "raw_input (" press to roll dice  ") roll = Dice_roll () total = int (roll [0]) + int (roll [1]) if total == 7 or total == 11: print "you rolled" + str (total) + "on your first roll ". Print "You Won!" Elife Total == 2 or Total == 3 or Total == 12: Print "You rolled" + str (total) + "on your first roll". Print "You Lost!" Else: Print "You have a" + str (total) + "roll on your first roll." Print "Print" is your point, before you do a 7 roll and lose it! " Point_cycle () global total main ()    

assuming that you use python There is a quick and dirty solution to get you started:

  # Save the dipes in a way that helps you reach each line differently Dices = (None, ("- - - +", "| |", "| * |", "| |", "+ ------- +"), # dice 1 ("+ ------- +", "| * |", | "|", | "," | * | "," + ------- + "), #Dice2 & lt; The second row of each dice   

and use a function like this:

  def print_deslist (diceslist): for the category I (5): For dicenum in dicelist: Printed DICES [Dice] [I] + "", Print   

You want to print dices, where diceslist results in a There is a list, such as: (1,3,4)

Of course there are very elegant / customized solutions, but this is a lot easier and can point you in an acceptable direction

Comments

Popular posts from this blog

excel vba - How to delete Solver(SOLVER.XLAM) code -

github - Teamcity & Git - PR merge builds - anyway to get HEAD commit hash? -

ios - Replace text in UITextView run slowly -