|
|

楼主 |
发表于 2012-3-6 09:15:08
|
显示全部楼层
代码帖的有点乱,怎么都没人能帮忙看看呢? 2 }9 `- {* f- V. w3 T4 `: H; {, ~" l) O0 [
public void spreadmoney(int m){- X% T- h+ i* @
for(int i=0;i<m;i++){
# t: {" P; n& x/ I* w, i* e int x = (int)(Math.random()*(moneyspace.getSizeX()));( ?& m! h3 w5 k' b
int y = (int)(Math.random()*(moneyspace.getSizeY()));
! |0 C! C# d2 t6 `, p9 U
1 ^/ U9 t9 t' a( i int I;
4 I# S2 [9 y z5 ?) N7 G. G2 E if(moneyspace.getObjectAt(x,y)!=null " F1 k8 n4 J* W- J' V$ a. A5 p
I = ((Integer)moneyspace.getObjectAt(x,y)).intValue();
9 }' \: R+ j- K9 T0 \/ Y1 J3 C }' ^; j9 [7 X# w( b1 o
else{; s+ e2 [- X1 D9 |
I = 0;* A8 L, j5 [$ a( b
}
6 A& {7 |! X. k1 z M8 N moneyspace.putObjectAt(x, y, new Integer(I+1)); }
8 \$ ^' r2 I2 V3 F, h4 m1 ` } |
|