Custom level creation/Simplex

From Turing Complete
wip
wip

This page descibes the early access verion 2.0.16 alpha. It may not be completely correct for the the current stable version, nor the latest unstable version. Help us update it, and you get a cookie.

stub
stub

This page is a stub. Help us expand it, and you get a cookie.

Simplex is Turing Complete's custom language. It is used in the levels test.si files for validating solutions.

Helpful tools[edit | edit source]

A VSCode syntax addon

Built-in functions[edit | edit source]

This list is incomplete, and some of the function signatures are guesses.

Arithmetic Operations[edit | edit source]

  • log10(x: AnyInt) Int
  • log10(number: U64) Int
  • ulog2(x: AnyUInt) Int
  • log2(x: AnySInt) Int
  • asr(x: AnyInt, shift_amount: AnyInt) Int
  • popcount(x: AnyInt) Int
  • trailing_zeros(x: AnyInt) Int

Arrays[edit | edit source]

  • array(element: @Type, length: Int) [@Type]
  • type_of_element(array: [@Element]) Type
    • Returns the type of the elements in the array.
  • quick_sort($arr: [@Any])
  • sort($arr: [@Any])

Display[edit | edit source]

  • hex(num: @Size) String
  • output(text: String)
  • print(x: @Any)
    • Prints x to the console.
  • str(x: @Type) String
    • Returns a string representation of x.

Dot functions[edit | edit source]

these use the dot operator, for example

let arr = [U64 0, 0, 0]
print( arr.len() ) // Prints 3
  • high(a: [@Any]) Int
  • in(value: @Type, array: [@Type]) Bool
  • len(array: [@Any]) Int

Memory[edit | edit source]

  • memory_clear(source: Ptr, length: Int)
  • memory_commit(pointer: Ptr, length: Int)
  • memory_copy(source: Ptr, destination: Ptr, length: Int)
  • memory_copy_reverse(source: Ptr, destination: Ptr, length: Int)
  • memory_free(pointer: Ptr, size: Int)
  • memory_reserve(length: Int) Ptr

Random[edit | edit source]

  • random() Int
  • random(max: Int) Int
  • random(type: @Type) @Type
  • randomize_seed(...?)
  • sample(array: [@Any]) @Any

Utility[edit | edit source]

  • assert(condition: Bool, error_code: Int)
  • int_of_size(value: Int, size: Int): @Sxx
    • Returns a signed integer of width size with value, all parameters must be resolved at compile time.

e.g. int_of_size(4, 32) is the same as S32 4

  • sleep(duration: Time)