# Complete ## Questions - does ASK create new turtles also ## Multiple Workspaces. Allow users to create multiple workspaces (perhaps as tabs or as separate windows) and to set, save, and load preferences for each workspace. You can define exactly what a workspace contains but, at the very least, it should have separate ### Needed Changes - Use Java Functional interfaces instead of custom made ones ### Features that will take more work. - turtle display areas with different numbers of turtles and states for each turtle and their pen - command histories, active variables, and user-defined commands - palettes for image shapes and colors - default command language and color theme - preferences (such as starting background, command language, color theme, color and image palettes, starting number of turtles, file of code to load, etc.) saved to and loaded from an XML or properties file (your team's choice) - Using the Java prefs classes. - But it exports as an XML file. - We also need to figure out exactly how the preference loading file works. ### Features that are relatively easy to implement. - click to execute commands from the history or user-defined commands (provide a means to enter needed parameters) - Josh added moving up one key but we can allow for multiple. - So we need to store a list of user commands internally somewhere. - click to edit the value of user-defined variables - click to toggle which turtles are currently active (active turtles should be graphically distinct from inactive ones) - I think this just involves an appearance change? so non active turtles can be smaller or maybe black or in the background. - provide a way to move the current turtle(s) graphically (at least FD, BK, LT, and RT by a fixed amount) - provide a way to change the pen's current properties graphically (up/down, thickness, etc.) - current state of a turtle (i.e., its ID, position, heading) and the pen (i.e., up/down, color, thickness) updated while the code is running. Feel free to include any other values you feel would be usefully associated with either. - Display coordinates of the turtle on the turtle - but other tracking values in the sand box as a - collapsable table/something similar. - - palettes of images and colors with their associated numeric values that can be referred to within new SLogo commands (i.e., it should be clear which images/colors are identified by which numbers so the SLogo language can refer to them in code). At the start, there should be a default set of values assigned to numbers to choose from that is configured from a properties file. - I think this is the set shape. set shape 0 represents the 0th item on the list of the turtle image. API: Model: InfoBundle will be changed to be a "Scope" that holds onto the variables and commands ```java= interface InfoBundle { Map<String, ASTFunction> commandsTable; Map<String, ASTNode> variables; List<Turtle> activeTurtles; List<Turtle> getActiveTurtles(); Turtle getMainTurtle(); void setCommand(String command, ASTNode node); void setVariable(String variable, double value); ASTNode getCommand(String command); double getVariable(String variable); } ``` ```java= class ExecutionEnvironment { List<Turtle> activeTurtles } ``` ```java= interface TrackableEnvironment { /** * Function that's * executed after a turtle is created within the model */ void setOnTurtleCreated(Runnable run); /** * Function that's executed after a change to the sandbox * environment is made. (New background color, new PenColor, new PenSize) */ void setOnSandboxUpdate(Consumer<SandboxRecord> updated); /** * if turtle is out of bounds make it pepe. * Sets the image for the currently active turtle */ void setOnShapeUpdate(IntConsumer update); // Sets the currently active turtle on the view void setOnActiveTurtleUpdate(IntConsumer update); } ``` ```java= record SandboxRecord(int penColor, int environmentColor, int penSize) ``` View: TurtleStatus - A pane that gives the PenColor, PenStatus, Location, and rotation of a turtle LocationLabel - A label on the turtle giving its current coordinates View: ```java= class TurleSandbox { new TurtleStatus } class TurtleView { new Location Label } class ModelController { executeCommand(String command, List<int> arguments); } ``` Tell whatttt?? ``` # active = 1 TELL 2 # active = 1 SETPENSIZE ID fd 100 # active 2 # fd 10 ``` ``` TELL 2 3 4 5 # active = 5 ```