zahra97 0 Newbie Poster
import random #allows a random value to be produced

a = input("Enter name for character 1") #variable verified, reports information to user
b = input("Enter name for character 2") #variable verified, reports information to user

c = int(input("Enter value for first strength for character 1")) #variable verified, reports information to user
d = int(input("Enter value for first strength for character 2")) #variable verified, reports information to user

cc = int(input("Enter value for first skill for character 1")) #variable verified, reports information to user
dd = int(input("Enter value for first skill for character 2")) #variable verified, reports information to user

print("Strength for", a, ":", c, ", Skill :", cc)
print("Strength for", b, ":", d, ", Skill :", dd)

if c > d : #conditional expression provides different arguments
    difference = c-d

else : #conditional expression provides different arguments
    difference = d-c

strengthmodifier = round(difference/5, 0)

print("The difference in strength is:", difference)

if cc > dd : #conditional expression provides different arguments
    difference2 = cc-dd

else : #conditional expression provides different arguments
    difference2 = dd-cc

31.skillmodifier = round(difference2/5, 0)
32.
33.print("The difference in skill is:", difference2)
34.
35.dice =  random.randrange(1,7)
36.dice2 = random.randrange(1,7)
37.
38.print (a, "rolls:", dice)
39.print (b, "rolls:", dice2)
40.
41.if dice > dice2 :#conditional expression provides different arguments
42.     print(a, "receives both strength and skill modifier.")
43.     print("New strength:", c, "+", strengthmodifier)
44.     print("New skill:", cc, "+", skillmodifier)
45.
46.elif dice < dice2: #conditional expression provides different arguments
47.     print(b, "receives both strength and skill modifier.")
48.     print("New strength:", d, "+", strengthmodifier)
49.     print("New skill:", dd, "+", skillmodifier)
50.
51.else : #conditional expression provides different arguments
52.    print("Dice throw was even. Neither player receive any modifiers.")

How do I do this?
Each player throws a 6 sided dice.
• If the scores on both dice are the same, no changes are made
• If the scores are not the same, the player with the highest score adds the ‘strength
modifier’ to the strength value and the ‘skill modifier’ to the skill value for their
character
• The player with the lower score on the dice subtracts these modifiers from the
strength and skill values for their character
• If a skill value becomes negative, then it is stored as zero
• If a strength value becomes zero or negative, then the character dies.
btw, my code is fully functioning, but I don't know how to do the above. any clues?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.