|
|

楼主 |
发表于 2012-3-6 09:15:08
|
显示全部楼层
代码帖的有点乱,怎么都没人能帮忙看看呢? 8 `% O: M" u/ _/ B" L4 j. q @" c ^
public void spreadmoney(int m){
. F2 A; M$ o1 `; e, F2 v4 C& u for(int i=0;i<m;i++){
& P# ^+ g+ E0 f- n) V) ~ int x = (int)(Math.random()*(moneyspace.getSizeX()));
8 y9 M5 C @5 `1 L& x5 j, y int y = (int)(Math.random()*(moneyspace.getSizeY()));
f9 K7 ?- |1 r6 B1 z
6 t, D$ u# a2 e0 y int I;4 ~8 Q G! s8 h% i7 m2 s/ ]0 T q
if(moneyspace.getObjectAt(x,y)!=null
. a7 s; u) _& k4 G* d9 N* R1 x$ [ I = ((Integer)moneyspace.getObjectAt(x,y)).intValue();3 C8 k! ^# u4 \* e7 C
}
7 ~. G' l5 N2 T/ A+ I0 ^ else{4 [! P5 b* N- S" T5 n9 O
I = 0;# B8 L9 V( X3 B2 M
}
3 j V7 X% s2 g3 b0 } moneyspace.putObjectAt(x, y, new Integer(I+1)); }6 Q, ]" s( d( u5 v* J
} |
|