FIXED4 Maths Guessing Game 3IN1

Submit

Your name:
File:
Open code-statistics:

Language is selected by the extension of the file. See the list of supported languages to know the extension of your language.

Problem

Please use this 5th Version! (Really sorry for this. Maybe I should go to bed earlier)

Is not as easy as you think.

First you get some Variables and rules. Rules are not overwriting the Variables, because every rule can contain this Variables.

Then the character of the player is given, he chooses one of all characters in this round. If a rule is specified, the value of the rule counts. If not, the normal Values are taken.

You need to calculate every value to get the winner.

This Problem is very hard, because in every input, there will be more and more that your code has to do! Be careful!

and it MUST BE very hard because even I didn't get it fixed for many times.....

Options

exec is denied

now post-mortem time, all source codes will be revealed

Sample input:_

a: 1
b: 6
c: 3

rule a: b-c
rule b: c-a
rule c: a-b

?a

Sample output:

value of a is now 1
value of b is now 6
value of c is now 3

set rule of a to a=b-c
set rule of b to b=c-a
set rule of c to c=a-b

a = 3
you win!

Sample input:_

a: 5
b: 2
c: 8
d: 10

rule a: c*3-b*2
rule b: c*2-a/5-b
rule c: b+d/2-b/a-3/d

?b

Sample output:

value of a is now 5
value of b is now 2
value of c is now 8
value of d is now 10

set rule of a to a=c*3-b*2
set rule of b to b=c*2-a/5-b
set rule of c to c=b+d/2-b/a-3/d
rule d not set

b = 13
you lose!
a wins!

Sample input:_

a: 3141

rule a: 0*(a-3009)/10
rule b: -3140+a
rule c: (a-141)/1000-2

?c

Sample output:

value of a is now 3141

set rule of a to a=0*(a-3009)/10
set rule of b to b=-3140+a
set rule of c to c=(a-141)/1000-2

c = 1
tie!

Ranking

Perl _

RankUserSizeTimeDateStatistics
1tails1730.00372011/01/22 05:36:550B / 75B / 74B
2teebee(tails)1630.00642011/02/03 03:46:540B / 71B / 69B

Python _

RankUserSizeTimeDateStatistics
1hallvabo2150.08182011/01/18 05:11:32129B / 59B / 26B
2twobit2490.07222011/01/13 00:25:100B / 137B / 88B

OCaml _

RankUserSizeTimeDateStatistics
1m.ukai3430.15382011/01/13 23:27:210B / 192B / 112B

gs2 _

RankUserSizeTimeDateStatistics
1whio1330.23492017/07/19 01:15:0219B / 65B / 28B

Language Ranking_

RankLangUserSizeScore
1gs2whio13310000
2Perlteebee(tails)1638159
3Pythonhallvabo2156186
4OCamlm.ukai3433877

return top