Data commit

This commit is contained in:
Ingy döt Net 2023-07-01 11:58:00 -04:00
parent 7387c8f97b
commit cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions

View file

@ -0,0 +1,37 @@
import Prelude;
import vis::Figure;
import vis::Render;
public void NumberReversalGame(){
//generate randomlist
L = [1..9];
score = 0;
randomlist = [];
while (L != []){
temp = takeOneFrom(L);
randomlist += temp[0];
L = temp[1];
}
// user interaction
score = 0;
text1 = "";
figure =
box(vcat([
box(text(str(){
return "<randomlist>";})),
box(textfield("Insert number of digits you would like to reverse here.",
void(str s){
score += 1;
n = toInt(s);
spliced = slice(randomlist, 0, n);
randomlist = reverse(spliced) + (randomlist - spliced);
},
fillColor("lightblue"))),
box(text(str(){
return ((randomlist == [1 .. 9]) ? "Well done! Your score: <score>." : "Keep going!");}))
]));
render(figure);
}