15 lines
497 B
Text
15 lines
497 B
Text
import vis::Render;
|
|
import vis::Figure;
|
|
import util::Math;
|
|
|
|
public void Guess(){
|
|
random = arbInt(10);
|
|
entered = "";
|
|
guess = false;
|
|
figure = box(vcat([
|
|
text("Try to guess the number from 0 to 9."),
|
|
textfield("Put your guess here", void(str s){guess = (toInt(s)==random); entered = s; }, fillColor("white")),
|
|
text(str(){return guess ? "Correct answer!" : "This is false, the number is not <entered>.";}),
|
|
button("Start over", void(){random = arbInt(10);}) ]));
|
|
render(figure);
|
|
}
|