about summary refs log tree commit diff stats
path: root/cpp/.traces/get_indirect
blob: 98e9d9c6afc03a2c8cec341ab851d2167c9cb177 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
parse/0: instruction: 1
parse/0:   ingredient: {name: "2", value: 0, type: 0, properties: ["2": "literal"]}
parse/0:   product: {name: "1", value: 0, type: 1, properties: ["1": "integer"]}
parse/0: instruction: 1
parse/0:   ingredient: {name: "34", value: 0, type: 0, properties: ["34": "literal"]}
parse/0:   product: {name: "2", value: 0, type: 1, properties: ["2": "integer"]}
parse/0: instruction: 1
parse/0:   ingredient: {name: "35", value: 0, type: 0, properties: ["35": "literal"]}
parse/0:   product: {name: "3", value: 0, type: 1, properties: ["3": "integer"]}
parse/0: instruction: 18
parse/0:   ingredient: {name: "1", value: 0, type: 2-6, properties: ["1": "address":"point", "deref": ]}
parse/0:   ingredient: {name: "0", value: 0, type: 0, properties: ["0": "offset"]}
parse/0:   product: {name: "4", value: 0, type: 1, properties: ["4": "integer"]}
after-brace/0: recipe main
after-brace/0: copy ...
after-brace/0: copy ...
after-brace/0: copy ...
after-brace/0: get ...
run/0: instruction main/0
run/0: ingredient 0 is 2
mem/0: storing 2 in location 1
run/0: instruction main/1
run/0: ingredient 0 is 34
mem/0: storing 34 in location 2
run/0: instruction main/2
run/0: ingredient 0 is 35
mem/0: storing 35 in location 3
run/0: instruction main/3
run/0: ingredient 0 is 1
mem/0: location 1 is 2
run/0: ingredient 1 is 0
run/0: address to copy is 2
run/0: its type is 1
mem/0: location 2 is 34
run/0: product 0 is 34
mem/0: storing 34 in location 4
s not passed then mark the given cell as visited # because it's the cell we're starting at. @visited[$y][$x] = True unless @visited; # neighbor block loops over the neighbors of $y, $x. neighbor: for neighbors(@puzzle, $y, $x).List -> $pos { # Move on to next neighbor if we've already visited this one. next neighbor if @visited[$pos[0]][$pos[1]]; # Mark this cell as visited but only until we search this # path. When moving to next neighbor, mark it False. @visited[$pos[0]][$pos[1]] = True; # $word is the string that we're going to lookup in the # dictionary. my Str $word = $str ~ @puzzle[$pos[0]][$pos[1]]; # range-starts-with returns a list of all words in the # dictionary that start with $word. with range-starts-with(@dict, $word) -> @list { if @list.elems > 0 { # If $word exist in the dictionary then it should be # the first element in the list. take @list[0], @visited if @list[0] eq $word; # Continue on this path because there are 1 or more # elements in @list which means we could find a word. word-search( # Don't pass the whole dictionary for next search. # Words that start with "ab" will always be a # subset of words that start with "a", so keeping # this in mind we pass the output of last # range-starts-with (@list). @list, @puzzle, $pos[0], $pos[1], $word, @visited ); } } # We're done looking up this path, mark this cell as False & # move on to another neighbor. @visited[$pos[0]][$pos[1]] = False; } }