Home > other >  A simulation algorithm to help modify the penalty kick
A simulation algorithm to help modify the penalty kick

Time:09-16

Simulate the real football penalty rules,

Said round round number
Round=1

Goal 1, not 0,
A and b respectively two team goals,

Consider only the first five rounds, behind one simple don't write,

While (round
=5){
If a goal +;
If b b++ goals;
If a - b> 5 - round return won a
If b - a> Win 5 - round return b
}

I tested, there is a BUG, for example, the first four rounds of free throws, a=2, b=3, the last of a penalty, b need not punishment (b++),
How to embody the, want to half a day can't think of, to help you, the scattered points,

CodePudding user response:

While (round
=5){
+
ALeftRound=5 - round
If a - b & gt; BLeftRound a victory
If b - a & gt; ALeftRound b victory
B++
BLeftRound=5 - round
}

You see that what holes

CodePudding user response:

While (+ + round
=5){
+
ALeftRound=5 - round
If a - b & gt; BLeftRound a victory
If b - a & gt; ALeftRound b victory
B++
BLeftRound=5 - round
}

CodePudding user response:

Round=1
A=0
B=0
BLeftRound=5
While round & lt;=5:
Print (round, a, b)
Italiy=int (input (" please input if team A goal "))
If italiy & gt; 0:
A +=1

ALeftRound=5 - round

If a - b & gt; BLeftRound:
Print (" A victory ")
Break
If b - a & gt; ALeftRound:
Print (" B "winning)
Break

Braze=int (input (" please input B team is scoring "))
If braze & gt; 0:
B +=1

BLeftRound=5 - round

If a - b & gt; BLeftRound:
Print (" A victory ")
Break
If b - a & gt; ALeftRound:
Print (" B "winning)
Break

Round +=1



While a==b:
Print (" draw at front, immediately below the one-to-one ")
Italiy=int (input (" please input if team A goal "))
If italiy & gt; 0:
A +=1
Braze=int (input (" please input B team is scoring "))
If braze & gt; 0:
B +=1

If a & gt; B:
Print (" A victory ")
Break
Elif b & lt; B:
Print (" B "winning)
Break

  • Related