Baklava in Unicat

Published on 28 August 2023 (Updated: 28 August 2023)

Welcome to the Baklava in Unicat page! Here, you'll find the source code for this program as well as a description of how the program works.

Current Solution

# Set up characters
0o00 πŸ˜»πŸ˜ΉπŸ˜ΈπŸ™€πŸ™€πŸ˜ΌπŸ˜ΈπŸ™€πŸ™€ Memory 0 = 0o40 (32 = ' ')
0o01 πŸ˜»πŸ˜ΉπŸ˜ΉπŸ™€πŸ™€πŸ˜½πŸ˜ΊπŸ™€πŸ™€ Memory 1 = 0o52 (42 = '*')
0o02 πŸ˜»πŸ˜ΉπŸ˜ΊπŸ™€πŸ™€πŸ˜ΉπŸ˜ΊπŸ™€πŸ™€ Memory 2 = 0o12 (10 = '\n')

# Set up constants
0o03 πŸ˜»πŸ˜ΉπŸ˜»πŸ™€πŸ™€πŸ˜ΉπŸ™€πŸ™€ Memory 3 = 1
0o04 πŸ˜»πŸ˜ΉπŸ˜ΌπŸ™€πŸ™€πŸ˜ΉπŸ™€πŸ˜Ώ Memory 4 = -1

# Set up varibles
0o05 πŸ˜»πŸ˜ΉπŸ˜½πŸ™€πŸ™€πŸ˜ΉπŸ˜ΊπŸ™€πŸ˜Ώ Memory 5 = -0o12 (-10) (loop_counter)

# Loop start: num_spaces = absolute value of loop_counter
0o06 πŸ˜»πŸ˜ΉπŸ˜ΎπŸ™€πŸ™€πŸ˜ΈπŸ™€πŸ™€ Memory 6 = 0
0o07 πŸ˜ΏπŸ™€πŸ˜ΈπŸ˜ΎπŸ™€πŸ™€πŸ˜½πŸ™€πŸ™€ Memory 6 += Memory 5 (num_spaces = loop_count)
0o10 πŸ˜½πŸ˜ΏπŸ˜ΎπŸ™€πŸ™€πŸ˜ΉπŸ˜ΉπŸ™€πŸ™€ If Memory 6 > 0, jump to 0x12 (0o11 + 1) (if num_spaces > 0)
0o11 πŸ˜ΏπŸ™€πŸ™€πŸ˜ΎπŸ™€πŸ™€πŸ˜ΌπŸ™€πŸ™€ Memory 6 *= Memory 4 (negate num_spaces)

# num_stars = 21 - 2*num_spaces
0o12 πŸ˜»πŸ˜ΉπŸ˜ΏπŸ™€πŸ™€πŸ˜ΊπŸ˜½πŸ™€πŸ™€ Memory 7 = 0o25 (21)
0o13 πŸ˜ΏπŸ™€πŸ˜ΊπŸ˜ΏπŸ™€πŸ™€πŸ˜ΎπŸ™€πŸ™€ Memory 7 -= Memory 6 (21 - num_spaces)
0o14 πŸ˜ΏπŸ™€πŸ˜ΊπŸ˜ΏπŸ™€πŸ™€πŸ˜ΎπŸ™€πŸ™€ Memory 7 -= Memory 6 (num_stars = 21 - 2*num_spaces)

# Display spaces
0o15 πŸ˜»πŸ˜ΉπŸ˜ΉπŸ™€πŸ˜ΏπŸ˜ΉπŸ˜ΏπŸ™€πŸ™€ Jump to 0o20 (0o17 + 1) (jump to check for num_spaces > 0)
0o16 πŸ˜½πŸ˜ΌπŸ˜ΈπŸ™€πŸ™€ Output Memory 0 (' ')
0o17 πŸ˜ΏπŸ™€πŸ˜ΊπŸ˜ΎπŸ™€πŸ™€πŸ˜»πŸ™€πŸ™€ Memory 6 -= Memory 3 (decrement num_spaces)
0o20 πŸ˜½πŸ˜ΏπŸ˜ΎπŸ™€πŸ™€πŸ˜ΉπŸ˜½πŸ™€πŸ™€ If Memory 6 > 0, jump to 0o16 (0o15 + 1) (if num_spaces > 0)

# Display stars
0o21 πŸ˜½πŸ˜ΌπŸ˜ΉπŸ™€πŸ™€ Output Memory 1 ('*')
0o22 πŸ˜ΏπŸ™€πŸ˜ΊπŸ˜ΏπŸ™€πŸ™€πŸ˜»πŸ™€πŸ™€ Memory 7 -= Memory 3 (decrement num_stars)
0o23 πŸ˜½πŸ˜ΏπŸ˜ΏπŸ™€πŸ™€πŸ˜ΊπŸ˜ΈπŸ™€πŸ™€ If Memory 7 > 0, jump to 0o21 (0o20 + 1)

# Output newline
0o24 πŸ˜½πŸ˜ΌπŸ˜ΊπŸ™€πŸ™€ Output Memory 2 ('\n')

# If loop_counter > 10, jump to Loop start
0o25 πŸ˜»πŸ˜ΉπŸ˜ΉπŸ˜ΈπŸ™€πŸ™€πŸ˜ΉπŸ˜ΊπŸ™€πŸ™€ Memory 8 (0o10) = 10 (0o12)
0o26 πŸ˜ΏπŸ™€πŸ˜ΊπŸ˜ΉπŸ˜ΈπŸ™€πŸ™€πŸ˜½πŸ™€πŸ™€ Memory 8 (0o10) -= Memory 5 (10 - loop_counter)
0o27 πŸ˜ΏπŸ™€πŸ˜ΈπŸ˜½πŸ™€πŸ™€πŸ˜»πŸ™€πŸ™€ Memory 5 += Memory 3 (increment loop_counter)
0o30 πŸ˜½πŸ˜ΏπŸ˜ΉπŸ˜ΈπŸ™€πŸ™€πŸ˜½πŸ™€πŸ™€ If Memory 8 (0o10) > 0, jump to 0o06 (0o05 + 1) (if loop_counter > 10, jump to Loop start)

0o31 πŸ™€πŸ™€ Exit

Baklava in Unicat was written by:

If you see anything you'd like to change or update, please consider contributing.

How to Implement the Solution

No 'How to Implement the Solution' section available. Please consider contributing.

How to Run the Solution

No 'How to Run the Solution' section available. Please consider contributing.