Skip to content

Instantly share code, notes, and snippets.

@porglezomp porglezomp/README.md
Last active Oct 20, 2019

Embed
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 hello.rs
$ rustc --test hello.rs
$ ./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) https://twitter.com/tj99er/status/1185701669696204800

use std::io::Write;
#[test]
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
\x1b[1\x41\r").expect("reset");
// 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.
std::process::exit(0);
}
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.