hoping for your help! I'm doing a java project that reproduces the logo language and im capped as I can't find an elegant and not too complicated way to switch between different rules / instructions, the project focuses on advanced programming and the use of Stream () is suggested; Predicate (); Function (); BiFunction () ect etc this is the list of instructions that I have implemented but that I have no idea how to branch them, i take them as a String:
- FORWARD (int);
- BACKWARD (int);
- LEFT (int);
- RIGHT (int);
- CLEARSCREEN;
- HOME;
- PENUP;
- PENDOWN;
- SETPENCOLOR (int) (int) (int);
- SETFILLCOLOR (int) (int) (int);
- SETSCREENCOLOR (int) (int) (int);
- SETPENSIZE (int);
- RIPETI (int) [ (cmds) ];
- Repeats the sequence of commands in the command list (cmds)
I have thought of an if () else () or a switch () but it does not seem very elegant