Anonymous user
24 game: Difference between revisions
m
→{{header|Elena}}
m (→{{header|Wren}}: Minor tidy) |
imported>Arakov |
||
Line 4,526:
auto level := new Integer(0);
s.forEach::(ch)
{
var node := new DynamicStruct();
Line 4,535:
$42 { node.Level := level + 2; node.Operation := mssg multiply } // *
$47 { node.Level := level + 2; node.Operation := mssg divide } // /
$40 { level.append(10); ^ self }
$41 { level.reduce(10); ^ self }
node.Leaf := ch.toString().toReal();
node.Level := level + 3
Line 4,625:
theNumbers := new object[]
{
1 + randomGenerator.nextInt
1 + randomGenerator.nextInt
1 + randomGenerator.nextInt
1 + randomGenerator.nextInt
}
}
Line 4,635:
{
console
.printLine
.printLine
.printLine
.printLine
.printLine
.printLine
.printLine
.printLine
.writeLine()
.printLine
.printLine
}
prompt()
{
theNumbers.forEach::(n){ console.print(n," ") };
console.print
}
Line 4,660:
var leaves := new ArrayList();
tree.readLeaves
ifnot (leaves.ascendant().sequenceEqual(theNumbers.ascendant()))
{
▲ .printLine:"Invalid input. Enter an equation using all of those four digits. Try again.";
var result := tree.Value;
Line 4,694 ⟶ 4,691:
if (expr == "")
{
console.printLine
}
else
Line 4,704 ⟶ 4,701:
catch(Exception e)
{
console.printLine
//console.printLine:"An error occurred. Check your input and try again."
}
|