diff options
Diffstat (limited to 'main.rs')
-rw-r--r-- | main.rs | 70 |
1 files changed, 64 insertions, 6 deletions
@@ -6,6 +6,34 @@ use std::fs::File; use std::io::Write; fn main() -> std::io::Result<()> { + // From https://ascii.co.uk/art/anime + let header = r#" + db db + dpqb dp8b + 8b qb_____dp_88 + 88/ . `p + q'. \ + .'. .-. ,-. `--. + |. / 0 \ / 0 \ | \ + |: `.__ ___.' | \\/ + |. " | ( + \. `-'-' ,' | + _/`------------'. .| + /. \\::(::[];)||:. \ + /. ' \.`:;;;;'''/`. .| +|. |/ `;--._.__/ |..| +|: _/_,'''',,`. `:.' +|. ` / , ',`. |/ + \. -'/\/ ',\ |\ + /\__-' /\ / ,: |.\ + /. .| ' /-. ,: |..\ +:. .| /| | , ,||: ..: +|. .` | '//` ,:|: :| +|.. .\ //\/ ,|: ..| + \. .\ <./ ,'. ../ + \_ ,..`.__ _,..,._/ + `\|||/ `--'\|||/'"#; + let letters = HashMap::from([ ( 'A', @@ -129,8 +157,8 @@ fn main() -> std::io::Result<()> { "0000000000 0001111000 0010000100 -0100000000 -0111000000 +0010000000 +0011100000 0000111000 0000000100 0010000100 @@ -164,6 +192,19 @@ fn main() -> std::io::Result<()> { 0000000000", ), ( + '1', + "0000000000 +0000110000 +0001110000 +0010110000 +0000110000 +0000110000 +0000110000 +0000110000 +0001111000 +0000000000", + ), + ( '2', "0000000000 0001111000 @@ -189,10 +230,24 @@ fn main() -> std::io::Result<()> { 0000001000 0000000000", ), + ( + '🙂', + "0000000000 +0000000000 +0011001100 +0011001100 +0000000000 +0100000010 +0100000010 +0011001100 +0001111000 +0000000000", + ), ]); - let ans = "HAPPYAPRILFOOLSDAY2024"; - let mut file = File::create("index.html")?; + let ans = "HAPPYAPRILFOOLSDAY202441🙂"; let mut rng = thread_rng(); + let mut file = File::create("index.html")?; + writeln!(file, "<!DOCTYPE html><!--{}-->", header)?; for c in ans.chars() { let letter = letters[&c].chars(); let mut zeros = letter @@ -201,12 +256,15 @@ fn main() -> std::io::Result<()> { .map(|(i, _)| i) .collect::<Vec<_>>(); zeros.shuffle(&mut rng); + let mut cnt = 0; for i in zeros { + cnt += 1; writeln!( file, - "<div style='color:white;position:absolute;top:{}px;left:{}px'>0</div>", + "<div style='color:white;position:absolute;top:{}px;left:{}px'>{}</div>", ((i / 11) as f32 + rng.gen_range(0.1..0.9)) * 50.0, - ((i % 11) as f32 + rng.gen_range(0.1..0.9)) * 50.0 + ((i % 11) as f32 + rng.gen_range(0.1..0.9)) * 50.0, + if cnt % 2 == 0 { "|" } else { "." } )?; } } |