RosettaCodeData/Task/Josephus-problem/Vedit-macro-language/josephus-problem.vedit
2023-07-01 13:44:08 -04:00

20 lines
312 B
Text

#1 = 41 // number of prisoners
#2 = 3 // step size
#3 = 1 // number of survivors
Buf_Switch(Buf_Free)
for (#5=0; #5<#1; #5++) {
Ins_Text("prisoner ") Num_Ins(#5, LEFT)
}
BOF
#4=1
while (#1 > #3) {
if (#4++ % #2 == 0) {
Del_Line(1)
#1--
} else {
Line(1)
}
if (At_EOF) { BOF }
}