This week's code snippet, Remove All Whitespace in Brainfuck, is brought to you by Subete and the Sample Programs repo.
[
Source for error message text:
https://copy.sh/brainfuck/text.html
]
; Mem 0 = 1 (indicate no input)
+
; Mem 1 = input; Loop while input not null
>,[
; Mem 0 = 0 (indicate input)
<[-]
; Mem 2 = input; Mem 3 = input; Mem 1 = 0
>>[-] ; Mem 2 = 0
>[-] ; Mem 3 = 0
<<[
>+ ; Inc Mem 2
>+ ; Mem Mem 3
<<- ; Dec Mem 1
]
; Sub 9 from Mem 3; If not zero (not tab)
>>---------[
; Dec Mem 3; If not zero (not newline)
-[
; Sub 3 from Mem 3; If not zero (not carriage return)
---[
; Sub 19 from Mem 3; If not zero (not space)
>+++[ ; Mem 4 = 3
<------ ; Sub 6 from Mem 3
>- ; Dec Mem 4
]
<- ; Dec Mem 3
[
; Display input (Mem 2) and reset Mem 3
<.
>[-]
]
]
]
]
; Mem 1 = input
<<,
]
; If no input; display error message
<[
[-]
-[--->+<]>.
+[--->+<]>+.
++[->+++<]>++.
++++++.
--.
+++[->+++<]>++.
[-->+<]>+++.
[-->+++++++<]>.
----.
-------.
----.
--[--->+<]>--.
++++[->+++<]>.
--[--->+<]>-.
[-->+++++++<]>.
++.
---.
+++++++.
[------>+<]>.
-----.
+.
--[--->+<]>-.
[->+++<]>+.
-[->+++<]>.
---[->++++<]>-.
+.
--.
---------.
+++++.
-------.
[-]
]
Below you'll find an up-to-date list of articles by me on The Renegade Coder. For ease of browsing, emojis let you know the article category (i.e., blog: βοΈ, code: π», meta: π, teach: π)
- βοΈ Google Threatens to Ruin Search as We Know It
- π The Problem With Assessing Instructor Difficulty
- π College Students Will Sometimes Have a Lapse in Judgement
- π We Have to End Our Cultural Obsession With Grades
- π» How to Automatically Calculate Letter Grades, But Every Solution Is Bad
- π Itβs Time We Talk About Student Evaluations of Teaching
- π» 3 Nasty Bugs in Software Development
- π» Modeling a Simple Relational Database Using CSVs and Python
- βοΈ Yet Another Instance of Misogyny in the Tech Field
- π Top Reasons Why You Donβt Need to Take Attendance (And Why I Do It Anyway)
Also, here are some fun links you can use to support my work.
This document was automatically rendered on 2024-05-24 using SnakeMD.