|
|

楼主 |
发表于 2012-3-6 09:15:08
|
显示全部楼层
代码帖的有点乱,怎么都没人能帮忙看看呢?
8 {: h( u& F$ X( I! E public void spreadmoney(int m){
' d& l; g4 H" r for(int i=0;i<m;i++){8 x& c0 m8 @0 @% D+ V7 S
int x = (int)(Math.random()*(moneyspace.getSizeX()));- W4 L- {( Q% F; w- @% b$ T1 T
int y = (int)(Math.random()*(moneyspace.getSizeY()));
1 `# F+ U8 X, t& W$ o, L$ x2 E
/ E3 C. T0 M8 u( E4 x. Q: c int I;& R( @8 y9 X8 I
if(moneyspace.getObjectAt(x,y)!=null
/ I# B% b6 r" ?7 W( j7 F0 ~/ ~ I = ((Integer)moneyspace.getObjectAt(x,y)).intValue();$ y! {1 g2 Y7 c" D0 v
}& Z6 [$ c7 ~, p6 j/ X: N
else{% W2 I0 x" a8 y
I = 0;
& e% u. }+ P" a$ @/ y* A2 _, N }
0 u; o9 s7 C" Y/ g8 T: h moneyspace.putObjectAt(x, y, new Integer(I+1)); }2 b8 ~9 Q9 ~& Q3 e8 \% N
} |
|