TheDonutProject icon indicating copy to clipboard operation
TheDonutProject copied to clipboard

Rust code

Open ThatXliner opened this issue 2 years ago • 7 comments

Description

Checklist

  • [X] I have read and followed the instructions in the README
  • [X] I have put the language I am adding in the name of this PR
  • [x] I have created a file named donut in the donuts folder with the proper file extension
  • [X] I have added a new key/value pair to info.json with the proper metadata

The thing is, I need to verify the rust-chatgpt code (this was ChatGPT's zero-shot output)

ThatXliner avatar Oct 16 '23 21:10 ThatXliner

Happy to help out with this one if needed - I have written enough Rust to make myself dangerous.

joeskeen avatar Oct 19 '23 08:10 joeskeen

works like a donut now

ThatXliner avatar Oct 21 '23 21:10 ThatXliner

The thing is, half of it is a comment. I wonder if that's fine. I can shrink it if needed.

ThatXliner avatar Oct 22 '23 20:10 ThatXliner

Nope, all good!

EvanZhouDev avatar Oct 22 '23 20:10 EvanZhouDev

Ok it doesn't work again because I think I forgot to copy another lien of code... I'll have to reformat all of this all over again. Perhaps we can just close this and use @joeskeen's PR? Here's a functional one-liner if that helps:

use std::thread;use std::time::Duration;fn main(){let mut A:f64=0.0;let mut B:f64=0.0;loop{let mut s=vec![' ';1760];let mut t=vec![0.0;1760];A+=0.05;B+=0.07;let o=A.cos();let e=A.sin();let n=B.cos();let c=B.sin();for o in 0..1760{s[o]=match o{o if o%80==79=>'\n',_=>' ',}}for i in (0..628).step_by(7){let r=(i as f64*0.01).cos();let a=(i as f64*0.01).sin();for i in (0..628).step_by(2){let l=(i as f64*0.01).sin();let f=(i as f64*0.01).cos();let A=r+2.0;let B=1.0/(l*A*e+a*o+5.0);let d:f64=l*A*o-a*e;let m=(40.0+30.0*B*(f*A*n-d*c))as i32;let v=(12.0+15.0*B*(f*A*c+d*n))as i32;let I=(m+80*v)as usize;let h=(8.0*((a*e-l*r*o)*n-l*r*e-a*o-f*r*c))as usize;if v<22&&v>=0&&m>=0&&m<79&&B>t[I]{t[I]=B;s[I]=".,-~:;=!*#$@".as_bytes()[h]as char;}}}print!("\x1b[J\x1b[H{}",s.iter().collect::<String>());thread::sleep(Duration::from_millis(50));}}

ThatXliner avatar Oct 22 '23 20:10 ThatXliner

I’m not gonna work on this

ThatXliner avatar Dec 22 '23 17:12 ThatXliner