|

楼主 |
发表于 2012-3-6 09:15:08
|
显示全部楼层
代码帖的有点乱,怎么都没人能帮忙看看呢? i9 ] b5 d5 R! b% D
public void spreadmoney(int m){3 y5 L9 ~" G- c6 W) c
for(int i=0;i<m;i++){
4 J- s0 C2 f! B; d int x = (int)(Math.random()*(moneyspace.getSizeX()));! R( q, N0 M& x
int y = (int)(Math.random()*(moneyspace.getSizeY()));- T& N T; a5 R. D/ U0 [- S8 n3 l
, f% ^0 f- n& C+ V, w; ^ int I;' _; G/ A5 g4 N S% ^1 g9 h" P5 z
if(moneyspace.getObjectAt(x,y)!=null 1 h7 S% d2 y: y) c" @
I = ((Integer)moneyspace.getObjectAt(x,y)).intValue();2 d# T4 q$ g5 W, v
}
$ o& d+ v* g [ else{
8 X" Z6 {" I" y5 q& ^ I = 0;
4 ~! G1 Q+ H7 r( q/ F; c. |/ @ }
! n( S Y8 Y G; ? moneyspace.putObjectAt(x, y, new Integer(I+1)); }
G8 N: L: v) ^" n0 r$ L6 [ } |
|