This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#![no_std] | |
extern crate alloc; | |
extern crate libc; | |
use alloc::{ vec, vec::Vec, }; | |
use core::convert::TryInto; | |
use libc::{ c_int, printf, }; | |
struct Room { | |
x: usize, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
extern crate sdl2; | |
use sdl2::audio::{ AudioCallback, AudioSpecDesired, }; | |
#[derive(Copy, Clone)] | |
enum Note { | |
A = 0, | |
ASharp = 1, | |
B = 2, | |
C = 3, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
extern crate sdl2; | |
use sdl2::{ | |
audio::{ AudioCallback, AudioSpecDesired, }, | |
event::Event, | |
pixels::Color, | |
}; | |
use std::{ time::{ Duration, Instant, }, }; | |
#[derive(Copy, Clone)] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use std::fmt; | |
#[derive(Debug, Copy, Clone)] | |
#[allow(dead_code)] | |
enum Sex { | |
Male, | |
Female, | |
} | |
impl Sex { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// u128 seem like the right type for debiting and crediting atoms of gold | |
// u256 should be enough account for all the gold atoms in the universe | |
// micrograms of gold seem like a good unit for small transactions | |
fn gold_atoms_in_microgram(quantity: f64) -> u128 { | |
const AVOGADROS_NUMBER: f64 = 6.02214076e23; // atoms | |
const ATOMIC_WEIGHT_OF_GOLD: u128 = 196_966_570; // microgram/mol | |
(quantity * AVOGADROS_NUMBER) as u128 / ATOMIC_WEIGHT_OF_GOLD | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env sh | |
# script flags | |
VERBOSE=true | |
# default inputs | |
DEFAULT_TEXT="The quick brown fox jumps over the lazy dog. Yes, the quick brown fox." | |
DEFAULT_COUNT=10 | |
# check if input is redirected |
OlderNewer