Skip to main content

Pickcode VL

Pickcode Visual Language (VL), is our experimental language for transitioning students from block to text based programming. To learn the basics of Pickcode VL, we'd suggest using the provided Intro to Pickcode VL lessons, which guide you through the basics of each project type.

Editing code

  • To add a line of code, press any green plus button
  • In the options that appear, select the type of code you want.
  • Press the grab button on the left side of a line of code to bring up the menu.
  • Press the red trash can button to delete a line of code. Press the button again to confirm deletion.
  • Drag on the grab button of a line of code to move a line of code.
  • While a line of code is selected, press the button at the top of the editor to copy it.

Keypad

  • abc: Enter a string
  • var: Select a variable
  • 123: Number
  • +: Addition/concatenate
  • ==: Equals
  • ,: Comma
  • .: Select a method/field from an object
  • ( or ): Insert parentheses
  • !=: Not equals
  • -: Subtraction/negation
  • *: Multiply
  • /: Divide
  • T/F: Boolean (true/false)
  • or: Logical or
  • and: Logical and
  • not: Logical not
  • >: Greater than
  • <=: Less than or equal
  • >=: Greater than or equal
  • mod: Modulo
  • ^: Exponentiation
  • Colors icon: Insert a color
  • File icon: Pick an available file name

Statement Types

  • call: Execute a function, ignoring its return value
  • set: Update the value of a variable
  • if: Execute code if a condition is true
  • else: Execute code if the condition in the associated if statement is false
  • for: Execute code repeatedly, updating the loop variable with each element in a list
  • var: Create a new variable and initialize it with a value
  • while: Execute code repeatedly, as long as a condition is true
  • return: End the execution of a function and return the value to the caller
  • function: Add a function. Functions have a name, an (optional) list of named parameters with types, a body, and a return type
  • comment: Add a comment. A comment is text that is not used in the execution of the program

Chat

Chat projects are for displaying output in message bubbles, similar to what you'd see in a phone's texting app.

  • chat.send(prompt: String): Send chat message to the chat window
  • chat.ask(prompt: String) returns String : Show prompt in the chat window, wait for the user to enter a message and return the user's response
  • chat.multipleChoice(prompt: String, options: List) returns String: Show prompt in the chat window with each option in the options list displayed. Wait for the user to select an option and return the user's choice

Paint

Paint projects are for creating drawings with a simplified version of turtle graphics.

  • paint.forward(dist: Number): Move paint brush forward by dist pixels, marking the canvas
  • paint.right(angle: Number): Rotate orientation of paint brush right by angle degrees
  • paint.left(angle: Number): Rotate orientation of paint brush left by angle degrees
  • paint.goto(x: Number, y: Number): Move paint brush to coordinates (x, y) without marking the canvas
  • paint.plot(f: Function, startX: Number, startY: Number): Function f must take Number parameter x, returning a number for the y coordinate of the point to be drawn at that x coordinate
  • paint.plot2d(f: Function, startX: Number, startY: Number, endX: Number, endY: Number): Function f must take Number parameters x and y, returning a string corresponding to the color to be drawn at coordinate (x, y)
  • paint.x : Current X coordinate of the paint brush (default: 0)
  • paint.y : Current Y coordinate of the paint brush (default: 0)
  • paint.angle: Current orientation of the paint brush
  • paint.color: Current color of the paint brush (default: #000000 (black))
  • paint.width : Current width of the paint brush (default: 5)
  • paint.speed : Current speed of the paint brush (default: 5)

Game

  • onKey(key: String, handler: Function): Call handler whenever keyboard key key is pressed
  • backgroundColor: Current background color of the game
  • addSprite(s: Sprite): Add Sprite s to the game screen
  • removeSprite(s: Sprite): Remove Sprite s from the game screen
  • addTextbox(t: Textbox): Add textbox t to the game screen
  • removeTextbox(t: Textbox): Remove textbox t from the screen
  • addTimer(handler: Function, intervalMS: Number): Call handler every intervalMS milliseconds
  • clear(): Remove all sprites and textboxes from game screen
  • width: Width of the game screen (default: 400)
  • height: Height of the game screen (default: 300)

Sprite

  • onTap(handler: Function): Call handler whenever sprite is clicked
  • x: X coordinate of Sprite. (0,0) is the top left of the screen
  • y: Y coordinate of Sprite. (0,0) is the top left of the screen
  • w: Width of sprite
  • h: Height of sprite
  • color: Color of sprite
  • image: Image file for sprite's background
  • zIndex: Z index of sprite. Sprites with higher Z indexes appear above others if they are overlapping
  • isTouching(other: Sprite): Returns true if the current sprite is overlapping other

TextBox

  • x: X coordinate of Sprite. (0,0) is the top left of the screen
  • y: Y coordinate of Sprite. (0,0) is the top left of the screen
  • text: Text shown in textbox
  • color: Color of text
  • fontSize: Font size of the text

List

  • List(...items: Any): Create a list initialized with the values of the parameters
  • .get(index: Number) returns Any: Returns the item at the specified index
  • .get(index: Number, value: Any) returns void: Changes item at the specified index to value
  • .add(item: Any): Pushes item to the end of the list
  • .length() returns Number: Returns the number of items in the list
  • .map(f: Function) returns List: Returns the result of calling f for every item in the list
  • filter(f: Function) returns List: Returns a new list, containing only elements for which f returns true.
  • join(separator: String) returns String: Returns a string containing all of the list elements with separator in between them

Map

  • Map(keys: List, values: List): Create a Map with specified keys and values (matched by index)
  • .get(key: String) returns Any: Returns the value with the specified key
  • .add(key: String, value: Any): Adds value to the Map with corresponding key
  • .size() returns Number: Returns the number of key/value pairs in the Map

String

  • .toUpperCase() returns String: Convert string to uppercase
  • .toLowerCase() returns String: Convert string to lowercase
  • .at(index: Number) returns String:Return character at specified index
  • .includes(searchStr: String) returns Boolean: Returns true if searchStr is contained in the string, false otherwise
  • .indexOf(searchStr: String) returns Number: Returns index of first instance of searchStr in the string, or -1 if searchStr is not present in the string
  • .split(separator: String) returns List: Returns a list created by dividing the string into substrings based on the provided separator. Example: "a,b,c".split(",") returns List("a", "b", "c")
  • .slice(startIndex: number, endIndex: number) returns String: Returns substring of string starting at startIndex (inclusive), ending at endIndex (exclusive)

Built ins

  • number(value: String) returns Number: Convert value to a number
  • numbers(start: Number, end: Number) returns List Returns List of numbers between start and end, exclusive of end

Math

  • math.min(values: List) returns Number: Returns the smallest number in the list
  • math.max(values: List) returns Number: Returns the largest number in the list
  • math.floor(x: Number) returns Number: Rounds a number down, returning the greatest integer less than or equal to x
  • math.ceil(x: Number) returns Number: Rounds a number up, returning the smallest integer greater than or equal to x
  • math.randomFloat(min?: Number, max?: Number) returns Number: Returns a random floating point (decimal) number that is between the provided minimum and maximum: If min and max aren't provided, they default to 0 and 1
  • math.randomInt(min: Number, max: Number) returns Number: Returns a random integer that is less than the provided maximum, and greater than or equal to the provided minimum
  • math.sqrt(x: Number) returns Number: Returns the square root of x
  • math.abs(x: Number) returns Number: Returns the absolute value of x
  • math.cos(x: Number) returns Number: Returns the cosine of x in radians
  • math.sin(x: Number) returns Number: Returns the sine of x in radians
  • math.tan(x: Number) returns Number: Returns the tangent of x in radians
  • math.log(x: Number, base?: Number) returns Number: Returns the logarithm of x in the provided base. If no base is provided, defaults to base e, the natural logarithm
  • math.parseInt(value: String) returns Number: Translates a string of digits into a number, interpretting it in base 10. If the string does not start with valid digits, the returned value will be the value NaN (not a number)