Skip to content

Instantly share code, notes, and snippets.

@porglezomp porglezomp/
Last active Oct 20, 2019

What would you like to do?
Creating a Rust hello world in 0x a presses.

This is a Rust "Hello World" program in 0x A presses.

$ vim
$ rustc --test
$ ./hello --quiet
Hello, World!

If you don't know, [the A Button Challenge] is a Mario 64 speedrun category in which runners attempt to use the A button (the jump button!) as few times as possible. Make sure you watch the classic Watch for Rolling Rocks - 0.5x A Presses video linked above in order to understand.

This project is TJ "Henry" Yoshi approved:

Nice - TJ "Henry" Yoshi (@tj99er)

use std::io::Write;
fn hello() {
// Ensure we don't need to use the compiler option to
// show the test output, which uses the forbidden letter.
let mut out = std::fs::File::open("/dev/stdout").expect("stdout");
// Overwrite the undesired output to hide it.
write!(out, "\x1b[2\x41
// Lets print! We need to use expect since the other
// one uses the letter which is not permitted.
writeln!(out, "Hello, World!").expect("write");
// Exit not so the test runner doesn't print more output.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.