|
|

楼主 |
发表于 2012-3-6 09:15:08
|
显示全部楼层
代码帖的有点乱,怎么都没人能帮忙看看呢? 4 n9 O$ ?% U, q0 I2 N) ^
public void spreadmoney(int m){$ q6 I6 t) h# a' x6 x
for(int i=0;i<m;i++){! V5 M9 V- ? x8 @1 w; b
int x = (int)(Math.random()*(moneyspace.getSizeX()));
0 X" S" f$ Y1 E! S int y = (int)(Math.random()*(moneyspace.getSizeY()));
8 ]' p A8 o- g
) T2 A' f! n b1 k; L. g! l8 H int I;3 x0 Z5 d( ]# ~; o, s
if(moneyspace.getObjectAt(x,y)!=null
! n/ ]6 \ S0 t6 ?# R I = ((Integer)moneyspace.getObjectAt(x,y)).intValue();
; S( _ @1 K; W& m4 M4 ^4 R }
; t5 T" ^. P: L4 K1 d& f else{
, _) T* N r }9 H8 `* {& {/ n I = 0;
# m6 M* g5 w7 N( j7 I# }4 V( x, e }
' d: D9 F) h3 M0 }# ^ moneyspace.putObjectAt(x, y, new Integer(I+1)); } k0 V6 ] W2 S# X! d+ U
} |
|