|

楼主 |
发表于 2012-3-6 09:15:08
|
显示全部楼层
代码帖的有点乱,怎么都没人能帮忙看看呢?
3 W) |" R, f$ @0 c public void spreadmoney(int m){
3 t" b& ]% M* \ |. c }8 m for(int i=0;i<m;i++){! M& ]% x3 C/ w3 N
int x = (int)(Math.random()*(moneyspace.getSizeX()));
* k6 ^0 Q6 |4 e! ~ int y = (int)(Math.random()*(moneyspace.getSizeY()));6 a7 ?8 q# e8 K' I* x N
: b; X. Z9 V: ~3 h int I;
+ y9 r3 D1 q7 |0 j7 O' N$ @: r if(moneyspace.getObjectAt(x,y)!=null ; d, W5 v- x2 F- `+ v
I = ((Integer)moneyspace.getObjectAt(x,y)).intValue();& n4 y# H5 f2 l5 W
}
( ~/ K0 d! X9 z' S0 z else{; u i: v" L; t) N
I = 0;9 Z: O8 r) N( O! p, x9 E9 d
}
% n; @0 K9 p( O0 A: x2 s' b6 f$ I moneyspace.putObjectAt(x, y, new Integer(I+1)); }" h0 p" O; I8 n' `
} |
|