package base;
public class Base {
int hit;
int out,base,point,team;
int[] hscore=new int[20];
int[] vscore=new int[20];
int time;
int check;
public static void main(String[] args) {
Base test=new Base();
}
Base(){
for(time=1;time<9;time++){
play();
vscore[time]=point;
play();
hscore[time]=point;
}
play();
check=0;
time=9;
vscore[time]=point;
check2();
if(check>50){
play();
hscore[time]=point;
}
check();
while(check<50){
time=time+1;
play();
vscore[time]=point;
play();
hscore[time]=point;
check();
}
report();
}
void report(){
int s,v1,h1;
v1=0;
for(s=1;s<time+1;s++){
v1=v1+vscore[s];
}
h1=0;
for(s=1;s<time+1;s++){
h1=h1+hscore[s];
}
System.out.println(time+","+h1+","+v1);
}
void check(){
int s,v1,h1;
v1=0;
for(s=1;s<time+1;s++){
v1=v1+vscore[s];
}
h1=0;
for(s=1;s<time+1;s++){
h1=h1+hscore[s];
}
if(h1>v1)check=100;
if(v1>h1)check=100;
}
void check2(){
int s,v1,h1;
v1=0;
for(s=1;s<10;s++){
v1=v1+vscore[s];
}
h1=0;
for(s=1;s<10;s++){
h1=h1+hscore[s];
}
if(h1>v1)check=100;
}
void hit(){
int z;
z=0;
if(Math.random()>0.7)z=100;
if(z<50)hit=0;
if(z>50)hit=100;
}
void play(){
int mode;
out=0;
base=0;
point=0;
mode=0;
team=1;
while(mode<50){
hit();
if(hit<50)out=out+1;
if(hit>50)base=base+1;
if(base==4)point=point+1;
if(base==4)base=3;
if(out==3)mode=100;
}
}
}
最終更新:2013年11月11日 16:44