|
|

楼主 |
发表于 2012-3-6 09:15:08
|
显示全部楼层
代码帖的有点乱,怎么都没人能帮忙看看呢?
( E1 Q) d& [" m. } public void spreadmoney(int m){
) S0 w2 s1 f. p: X$ z for(int i=0;i<m;i++){1 B t# c1 z7 N8 n( ]
int x = (int)(Math.random()*(moneyspace.getSizeX()));
$ e: r0 ?" Y& A- J' P& N0 ?5 J int y = (int)(Math.random()*(moneyspace.getSizeY()));2 o5 Y" f7 h' i/ E9 u3 ?8 H3 e: p
3 O, D$ }( W, d0 Q; g* D/ F( [
int I;0 L6 S2 t% v& f) J
if(moneyspace.getObjectAt(x,y)!=null
, A9 s: _ ]9 n I = ((Integer)moneyspace.getObjectAt(x,y)).intValue();
6 T2 y2 d' W" H, E }
. Z/ `! i7 B6 E else{
5 a; o0 `, |% e0 k I = 0;
' F3 D' [' m' y' m3 q }' y% g% ~- Q% v' |( S+ T- x
moneyspace.putObjectAt(x, y, new Integer(I+1)); }* q. p6 F3 I6 d3 A8 @8 l$ t
} |
|