Exemple #1
0
def test_rewind_randint():
    writeint(r())
    checkpoint()
    writeint(r())
    rewind()
    writeint(r())
    v = readints()
    assert len(v) == 4
    assert v[0] != v[1]
    assert v[1] == v[2]
    assert v[2] != v[3]
    assert v[0] != v[2]
    assert v[1] != v[3]
    assert v[0] != v[1]
Exemple #2
0
from rew import rewind, checkpoint
from sys import stdin


loc = dict()
glob = dict()

while True:
    checkpoint()
    print(loc)
    print(">>>", end="", flush=True)
    snippet = stdin.readline().strip()
    if snippet == "":
        rewind(-1)
        break
    if snippet == "undo":
        rewind()
    else:
        try:
            exec(snippet, glob, loc)
        except Exception as e:
            print(e)
Exemple #3
0
from rew import rewind, checkpoint
from random import randint

print(randint(0, 99))
checkpoint()
print(randint(0, 99))
rewind()
print(randint(0, 99))
Exemple #4
0
from rew import rewind, checkpoint

a = 0
print(a)
checkpoint()
print(a)
a = 1
print(a)
rewind()  # pop and go back
print(a)