any idea about making any java game programme?
pc games or mobile games??
bro. how about snake game, it maybe old, but it's worth a practice for bigger games in the future?
our favorite past-time during college days, hehe
Snake Game. (built for IE browser only)
Just don't try to explore that link, kay bati ko mo program ug design at that time. hehehe.
I just preserve it that way.
Guys, pwede ko patabang?Ug i-run naku ni kay kani man mugawas Exception in thread "main" java.lang.NoClassDefFoundError:..sakto ba ni nga program?ang source code ani ako ra man gud gikopya para sa usa ka-input niya ako gamitan ug 3 ka inputs..sakto ba gihapon ang source code?mag error man lagi ug i-run..pls..heeellp..
import java.io.*;
import javax.swing.*;
public class p
{
public p()
{
String end = "";
while(!end.equalsIgnoreCase("X"))
{
String inp = JOptionPane.showInputDialog(null, "Enter value(s) separated by space ");
String [] digits = new String[inp.length()];
int j = 0;
for(int i = 0; i < inp.length(); i++)
digits[i] = "";
for(int i = 0; i < inp.length(); i++)
{
if(!Character.isWhitespace(inp.charAt(i)))
{
digits[j] = digits[j] + inp.charAt(i);
}
else j+=1;
}
j+=1;
float []input = new float[j];
for(int i = 0; i < j; i++)
{
try{
input[i] = Float.parseFloat(digits[i]);
}catch(NumberFormatException nf){System.out.printf("ERROR");}
}
String b = "Inputs : ";
for(int i = 0; i < j; i++)
b = b + "\n"+" "+ digits[i] ;
JOptionPane.showMessageDialog(null,b + "\n"+ "Output : "+DiscipulusJavaFunction(input));
end = JOptionPane.showInputDialog(null, "Press X if you want to terminate application ");
}
}
public static void main(String []args)
{
p F = new p();
}
final double trunc(double x)
{
return (x>=0) ? Math.floor(x) : Math.ceil(x);
}
final double trunc(double x)
{
return (x>=0) ? Math.floor(x) : Math.ceil(x);
}
final double f2xm1(double x)
{
return ( (Math.abs(x)<=1) ? (Math.pow(2,x)-1) : ((x==Double.NEGATIVE_INFINITY) ? -1 : x));
}
float DiscipulusJavaFunction(float [] v)
{
double [] f=new double[8];
double tmp = 0;
boolean cflag = false;
f[0]=f[1]=f[2]=f[3]=f[4]=f[5]=f[6]=f[7]=0;
f[0]-=v[3];
f[1]+=f[0];
f[0]/=f[0];
tmp=f[1]; f[1]=f[0]; f[0]=tmp;
f[0]-=v[1];
f[0]=-f[0];
f[0]+=1.048232078552246f;
tmp=f[2]; f[2]=f[0]; f[0]=tmp;
f[0]-=v[0];
f[0]+=f[1];
f[0]=Double.isNaN(f[0]/f[1]) || Double.isInfinite(f[0]/f[1]) ? f[0]/f[1] : f[0]-(trunc(f[0]/f[1])*f[1]);
f[0]-=f[2];
f[0]+=v[2];
tmp=f[2]; f[2]=f[0]; f[0]=tmp;
f[0]-=-1.174947738647461f;
f[1]*=f[0];
f[0]+=f[0];
f[1]-=f[0];
f[0]=Math.sin(f[0]);
f[0]+=f[1];
f[0]+=f[0];
f[0]+=f[2];
f[0]=-f[0];
f[0]=Math.sqrt(f[0]);
f[0]=Math.sin(f[0]);
f[1]+=f[0];
f[1]+=f[0];
f[0]*=v[1];
tmp=f[2]; f[2]=f[0]; f[0]=tmp;
f[0]+=f[0];
f[0]-=0.4281637668609619f;
f[0]=-f[0];
f[0]=Math.sqrt(f[0]);
f[0]=Math.sin(f[0]);
f[1]+=f[0];
f[0]=Math.abs(f[0]);
f[2]-=f[0];
f[1]+=f[0];
f[0]+=f[0];
f[2]-=f[0];
f[1]+=f[0];
f[0]*=f[0];
f[0]+=f[1];
f[0]+=f[0];
f[0]+=-0.9486191272735596f;
f[0]=-f[0];
f[0]=Math.sqrt(f[0]);
f[0]=Math.sin(f[0]);
f[0]+=f[0];
f[0]+=f[1];
tmp=f[1]; f[1]=f[0]; f[0]=tmp;
if (!cflag) f[0] = f[1];
f[0]+=f[1];
f[0]+=-1.907608032226563f;
f[0]=-f[0];
f[0]=Math.sqrt(f[0]);
f[0]=Math.sin(f[0]);
f[1]+=f[0];
f[2]+=f[0];
f[1]+=f[0];
f[0]+=f[0];
f[0]+=f[1];
f[0]+=f[0];
f[0]-=f[2];
f[0]=Math.abs(f[0]);
f[0]=Math.sqrt(f[0]);
tmp=f[2]; f[2]=f[0]; f[0]=tmp;
f[0]+=f[0];
f[0]=Double.isNaN(f[0]/f[1]) || Double.isInfinite(f[0]/f[1]) ? f[0]/f[1] : f[0]-(trunc(f[0]/f[1])*f[1]);
f[0]+=f[1];
f[0]=-f[0];
f[0]=Math.sqrt(f[0]);
f[0]+=f[2];
f[0]*=-0.9765300750732422f;
f[0]*=v[1];
tmp=f[2]; f[2]=f[0]; f[0]=tmp;
if (!cflag) f[0] = f[1];
f[0]+=f[1];
f[0]-=v[2];
f[0]+=f[2];
f[0]=Math.abs(f[0]);
f[0]=Math.sqrt(f[0]);
f[0]=Math.sin(f[0]);
f[1]+=f[0];
f[0]=-f[0];
f[0]=f2xm1(f[0]);
f[1]-=f[0];
if (!cflag) f[0] = f[1];
f[0]+=f[1];
f[0]+=-1.641227006912231f;
f[0]=-f[0];
f[0]=Math.sqrt(f[0]);
f[0]=Math.sin(f[0]);
f[1]+=f[0];
f[0]=Math.abs(f[0]);
f[0]+=v[0];
f[0]+=v[1];
f[0]=Math.cos(f[0]);
f[1]+=f[0];
f[0]/=-1.924433708190918f;
f[0]=-f[0];
f[1]-=f[0];
f[0]/=f[0];
f[0]*=-0.6102392673492432f;
f[0]+=v[1];
f[0]=-f[0];
f[0]/=f[1];
f[1]-=f[0];
f[1]-=f[0];
f[0]/=0.1756083965301514f;
f[0]=Math.sin(f[0]);
f[0]+=v[0];
f[0]/=-1.427085638046265f;
f[0]=Math.cos(f[0]);
f[1]+=f[0];
f[0]/=v[2];
f[0]=Math.abs(f[0]);
f[1]+=f[0];
f[0]=-f[0];
f[1]-=f[0];
if (!cflag) f[0] = f[1];
f[0]+=f[1];
f[0]-=v[0];
f[0]=-f[0];
f[0]=Math.sqrt(f[0]);
f[0]=Math.sin(f[0]);
f[1]+=f[0];
if (!cflag) f[0] = f[1];
f[0]+=f[1];
f[0]=-f[0];
f[0]=Math.sqrt(f[0]);
if (Double.isInfinite(f[0]) || Double.isNaN(f[0]))
{
f[0]=0;
};
return (float) f[0];
}
Similar Threads |
|