|
|

楼主 |
发表于 2012-3-6 09:15:08
|
显示全部楼层
代码帖的有点乱,怎么都没人能帮忙看看呢? - O/ k: y! p( v
public void spreadmoney(int m){
2 G( ~% k* S( P+ L" i- o3 P3 i for(int i=0;i<m;i++){% y' M% n) p) ]. D
int x = (int)(Math.random()*(moneyspace.getSizeX()));4 L- j8 p; v( ~' |* u8 I
int y = (int)(Math.random()*(moneyspace.getSizeY()));
, s3 h/ T/ _" S7 E* S9 v0 e4 |8 o9 w, e) H7 t3 O- X3 U
int I;* G4 _- T- d& m. ]' {/ L
if(moneyspace.getObjectAt(x,y)!=null
2 p4 y% I1 M% d6 f, u I = ((Integer)moneyspace.getObjectAt(x,y)).intValue();) R0 C: N: J" F( Z0 L0 o
}( S- z+ o: G1 |2 V% h
else{# ^" R2 z- i4 h3 ]+ z
I = 0;
5 M5 s6 [6 b/ J T }
. g" x7 N3 ]. W$ {2 E( z8 b% @ moneyspace.putObjectAt(x, y, new Integer(I+1)); }
: i) ~* w+ j; ^" M7 V0 F } |
|