PrequelPlay
play with code


Documentation

Main program

Input:

pqp.ticks_per_second
 Constant (30).
pqp.elapsed_ticks
 Number of ticks elapsed executing the program.
 Resets every 27000 ticks (15 minutes).
 Updates only after each call to pqp.update.
pqp.palette
 Current palette.
 Defaults to the CGA palette.
 Can be changed with pqp.set_palette.
pqp.camera
 Constant (0).
pqp.none
 Constant (1).
pqp.max_vertex_count
 Constant (9600).
pqp.max_sound_count
 Constant (32).
pqp.max_sound_priority
 Constant (32).
pqp.max_sound_channels
 Constant (4).
pqp.max_main_instrs_tick
 Constant (10232).
pqp.max_main_memory_kb
 Constant (16384).
pqp.max_bot_count
 Constant (4).
pqp.max_bots_instrs_tick
 Constant (2568).
pqp.max_bot_memory_kb
 Constant (1024).
pqp.status_idle
pqp.status_run
pqp.status_return
pqp.status_halt
pqp.status_error
pqp.status_cancel
 Constants (0, 1, 2, 3, 4, 5).
pqp.state_unknown
pqp.state_wait
pqp.state_unchanged
pqp.state_notset
pqp.state_ok
 Constants (0, 1, 2, 3, 4).

Functions:

pqp.update()
 Update the display.
 Restart program counter.
 Note: Many other functions take effect
  only after calling this one.
pqp.set_title(title)
 Takes effect after pqp.update
  (throttled down to once per second).
pqp.set_palette(palette)
 Takes effect after pqp.update.
obj = pqp.create(points)
 
pqp.remove(obj)
 
pqp.set_color(obj, coloridx)
 Takes effect after pqp.update.
pqp.set_visible(obj, bool)
 Takes effect after pqp.update.
pqp.set_origin(obj, x, y)
 Takes effect after pqp.update.
pqp.set_angle(obj, angle)
 Takes effect after pqp.update.
pqp.set_scale(obj, scale)
 Takes effect after pqp.update.
pqp.set_touchable(obj, bool)
 
pqp.move_to_front(obj, other_obj)
 Takes effect after pqp.update.
pqp.move_to_back(obj, other_obj)
 Takes effect after pqp.update.
?sx, ?sy = pqp.read_pressed()
?sx, ?sy = pqp.read_released()
 If event pressed/released, then
  sx and sy are the values
   of the screen coordinates.
 Otherwise,
  sx and sy are undefined
x, y = pqp.screen_to_world(sx, sy)
 
obj = pqp.get_touchable(x, y, prev_obj)
 
bool = pqp.is_contained(x, y, obj)
 
bool = pqp.are_overlapping(obj, other_obj)
 
pqp.sound(soundidx, ?priority=1)
 
y, i, q = pqp.rgb_to_yiq(r, g, b)
r, g, b = pqp.yiq_to_rgb(y, i, q)
h, l, s = pqp.rgb_to_hls(r, g, b)
r, g, b = pqp.hls_to_rgb(h, l, s)
h, s, v = pqp.rgb_to_hsv(r, g, b)
r, g, b = pqp.hsv_to_rgb(h, s, v)
 
pqp.reset(max_parallel_bots)
 
bool = pqp.is_loaded(botidx)
 
bool = pqp.is_accepting(botidx)
 
pqp.accept(botidx)
 Takes effect after pqp.update.
pqp.refuse(botidx)
 Takes effect after pqp.update.
pqp.unload(botidx)
 Takes effect after pqp.update.
bool = pqp.launch(botidx, data)
 Takes effect after pqp.update.
 Note: If data > 1048576 chars,
  it defaults to the empty list.
pqp.cancel(botidx)
 
status = pqp.get_status(botidx)
 
result = pqp.read_result(botidx)
 
y, mo, d, h, mi, s, w = pqp.get_date()
 Get date (UTC), where
  y = year : 0 -> 2000, 1 -> 2001, ...
  mo = month : 0 -> Jan, ..., 11 -> Dec
  d = day : 0 -> 1, ..., 30 -> 31
  h = hours : 0, ..., 23
  mi = minutes: 0, ..., 59
  s = seconds: 0, ..., 59
  w = weekday: 0 -> Sun, ..., 6 -> Sat
pqp.srandom(seed)
 
pqp.set_state(state)
 Takes effect after pqp.update
  (throttled down to about once per minute).
status, ?state = pqp.read_state()
 Note: status = pqp.state_unknown if
  project cannot be found on server.
  Try to (re-)upload it.
 Note: New states are throttled down
  to about once per minute

Bots program

Input:

pqp.data
 Number or list
  from which the bot result must be calculated
  and returned through function pqp.return.

Functions:

pqp.return(result)
 End computation and
  pass the result (number or list)
  to the main program (pqp.read_result).