User loginNavigation |
Reversing operationsIf one wants to iterate through all reachable states s1 from an initial state s0 in an imperative language (think of a chess board and a possible set of moves) one could do something like:
for i in 1..#changes {
s1 := copy(s0)
change(s1, i)
// process s1
}
It is usually faster and less memory intensive to do the following instead:
for i in 1..#changes {
change(s0, i) pushing undo data to the stack
// process s0
undo(s0) popping undo data from the stack
}
Are there general techniques for inferring the "undo data" that an operation should save, and possibly the corresponding undo operation? By Pablo Barenbaum at 2012-03-12 17:03 | LtU Forum | previous forum topic | next forum topic | other blogs | 8477 reads
|
Browse archives
Active forum topics |
Recent comments
5 weeks 4 days ago
5 weeks 5 days ago
5 weeks 6 days ago
5 weeks 6 days ago
6 weeks 4 days ago
6 weeks 4 days ago
6 weeks 4 days ago
9 weeks 5 days ago
10 weeks 3 days ago
10 weeks 4 days ago