|
|

楼主 |
发表于 2012-3-6 09:15:08
|
显示全部楼层
代码帖的有点乱,怎么都没人能帮忙看看呢? " A7 x+ c- w4 ?; f8 {
public void spreadmoney(int m){; B2 v8 x h: j
for(int i=0;i<m;i++){# x0 r. A2 s& j9 g% t" s: p
int x = (int)(Math.random()*(moneyspace.getSizeX()));7 a1 r/ \$ _! o" J5 n) t
int y = (int)(Math.random()*(moneyspace.getSizeY()));
5 M: {6 h1 O1 C: G7 r* U
0 Q+ }! {0 O+ `3 w B' r; N) e" v int I;+ H7 l* W! E- a' ^; [4 h. w" K
if(moneyspace.getObjectAt(x,y)!=null 9 K. r* E2 W8 `/ V7 f8 |4 R5 |1 O
I = ((Integer)moneyspace.getObjectAt(x,y)).intValue();
- N- N y$ B/ d }' m( w! i% Z# F( O6 O }+ ^6 C; `! V# j3 X' ?" j! M! P1 G
else{ |& V: @. N2 O% j
I = 0;
; u, b6 f5 u8 g$ l }% E3 _9 N9 \9 k- e- D. i. s
moneyspace.putObjectAt(x, y, new Integer(I+1)); }9 w, P+ u; E* z6 b
} |
|