Differences
This shows you the differences between two versions of the page.
| Both sides previous revision Previous revision | |||
| creating:actions [2026/11/19 01:37] – Fixed OR/EXISTS state exploration bug, and made ENABLED accept partial states ahelwer | creating:actions [2026/11/19 02:03] (current) – Fixed input handling ahelwer | ||
|---|---|---|---|
| Line 285: | Line 285: | ||
| Now we can write the central '' | Now we can write the central '' | ||
| - | <code java [highlight_lines_extra=" | + | <code java [highlight_lines_extra=" |
| while (!possibleNext.isEmpty()) { | while (!possibleNext.isEmpty()) { | ||
| Map< | Map< | ||
| Line 547: | Line 547: | ||
| <code java [highlight_lines_extra=" | <code java [highlight_lines_extra=" | ||
| List< | List< | ||
| - | interpreter.getNextStates(action.location, | + | interpreter.getNextStates(action.location, |
| if (nextStates.isEmpty()) { | if (nextStates.isEmpty()) { | ||
| action.accept(interpreter); | action.accept(interpreter); | ||
| Line 573: | Line 573: | ||
| If there are multiple possible next states, the user is prompted to choose one: | If there are multiple possible next states, the user is prompted to choose one: | ||
| <code java> | <code java> | ||
| - | private static Map< | + | private static Map< |
| if (nextStates.size() == 1) { | if (nextStates.size() == 1) { | ||
| return nextStates.get(0); | return nextStates.get(0); | ||
| Line 583: | Line 583: | ||
| System.out.print("> | System.out.print("> | ||
| - | | + | return nextStates.get(Integer.parseInt(reader.readLine())); |
| - | | + | |
| - | } | + | |
| } | } | ||
| } | } | ||
| + | </ | ||
| + | |||
| + | Since we are reading from '' | ||
| + | <code java [highlight_lines_extra=" | ||
| + | private static void tryStep(Stmt.Print action) throws IOException { | ||
| + | Object result = interpreter.executeBlock(action.expression, | ||
| + | </ | ||
| + | <code java [highlight_lines_extra=" | ||
| + | private static void run(String source, boolean replMode) throws IOException { | ||
| + | Scanner scanner = new Scanner(source); | ||
| </ | </ | ||