Skip to content

Instantly share code, notes, and snippets.

@takanakahiko
Created January 6, 2015 14:49
Show Gist options
  • Save takanakahiko/51df19327baceb579386 to your computer and use it in GitHub Desktop.
Save takanakahiko/51df19327baceb579386 to your computer and use it in GitHub Desktop.
コサイン波の観測。ゲームとかのふわふわ表現に使えるやつね。(1.6)
public class CosWave{
public static void main(String[] args){
int n = Integer.parseInt(System.console().readLine("いくつまでやりますか? ->"));
double PI = 3.14;
for(int i = 0; i < n; i ++){
try{
Thread.sleep(100);
}catch(InterruptedException e){}
int m = 10+(int)(10*Math.cos(PI*i/10));
for(int j = 0; j < m; j++)
System.out.print(" ");
System.out.println("*");
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment