stationeers.de Mod workshop · Dominik1199
DE Sign in
  1. Home
  2. IC10 academy
  3. Day 5

Day 5 of 365 · Beginner · Month 1: First steps

Comments and the three limits

Comments with # and the three hard limits: 128 lines, 4096 characters, 90 characters per line – and why the character limit almost always breaks first.

Lesson 9 min Week 1

What you learn today

  • Write comments with #
  • 128 lines, 4096 characters, 90 characters per line
  • What counts towards them

A program you no longer understand after three weeks is a broken program. Comments help against that. But they cost space, and space on the chip is tight.

Comments

The chip ignores everything from # to the end of the line. A comment may fill a whole line or sit behind an instruction:

# pressure in bar for the hallway display
div r1 r0 100   # 100 kPa = 1 bar

Good comments say why something is the way it is or what a number means. # r1 = r0 / 100 helps nobody, the instruction already says that.

Warning

Special characters such as German umlauts or the degree sign turn into “?” in the game, because the game only stores ASCII. Stick to plain letters in comments: # deg C instead of °C.

The three limits

LimitValuewhat counts
Lines128every line: instructions, blank lines, comment lines, labels, define, alias
Characters in total4096every character, including spaces and comments
Characters per line90the whole line including its comment

More does not fit on the chip. There is no trick that makes a line “not count”.

Which limit breaks first?

Do the math: 4096 characters divided by 128 lines is 32 characters per line. An instruction like add r1 r0 273.15 has 16 characters. With a comment behind it you quickly reach 45. That is why with commented programs the character limit is almost always the binding one, not the line count.

# --- conversion for the status panel ---
sub r1 r0 273.15   # Kelvin to degrees C
mul r2 r1 1.8      # Fahrenheit, step 1
add r2 r2 32       # Fahrenheit, step 2

Four lines, a good 140 characters. Only 44 of them are instructions.

When it gets tight

  • Shorten comments, cut filler words. “deg C” instead of “converted to degrees Celsius”.
  • Use blank lines sparingly.
  • The game version from the last lesson strips comments and blank lines for the chip. You keep the commented version for yourself.
  • The IC10 coder always shows lines, characters and width in the bar at the top.
Note

Until May 2024 the in-game editor was only 64 characters wide. Old code from the internet is therefore often wrapped noticeably narrow.

Diagram

The three limits of a program Lines 74/128 Characters 3990/4096 Width 97/90 Comments and blank lines count fully. The longest line here is too wide.
Lines, characters and width are counted separately. Comments and blank lines count fully, a single line that is too wide is enough for an error.

Exercise

Task

The starter code converts a temperature, but cannot go onto the chip like this:

  • The first line is longer than 90 characters. Shorten the comment.
  • A comment contains the special character °. Leave it out.
  • Add the missing calculation: r2 = temperature in Fahrenheit (°C · 1.8 + 32).

r0 is the temperature in Kelvin (set by the test), r1 in °C.

Hints

Hint 1

The IC10 coder shows the width of the longest line at the top.

Hint 2

“°F” simply becomes “F”.

Hint 3

Fahrenheit in two lines: mul r2 r1 1.8, then add r2 r2 32.

Quiz

5 questions. You pass from 60 % – the server does the grading.

Complete the day

  • Passed the simulator exercise
  • Passed the quiz with at least 60 %

Without an account progress is saved in this browser only.

Report a mistake in this lesson

Please sign in to report. Sign in

Esc
↑ ↓ selectEnter open/ opens search anywhere