|

楼主 |
发表于 2012-3-6 09:15:08
|
显示全部楼层
代码帖的有点乱,怎么都没人能帮忙看看呢? |2 _5 d" ], P1 [8 v( j" i; A2 D( w
public void spreadmoney(int m){" O: F: h0 T: Y: X. {7 l+ N: f
for(int i=0;i<m;i++){
) w9 x6 p9 Z Q0 V K1 h2 M int x = (int)(Math.random()*(moneyspace.getSizeX()));
9 g, f$ ^9 ]9 [& \. R1 t' {: H int y = (int)(Math.random()*(moneyspace.getSizeY()));8 }' `, X8 f: t4 A' y
; j( w* e& U- C int I;8 T2 V, I* A0 S7 }* X* [
if(moneyspace.getObjectAt(x,y)!=null
2 x9 g+ I: c! m( j) H I = ((Integer)moneyspace.getObjectAt(x,y)).intValue();5 R5 ], [+ A8 R, d; d
}
# A* F9 t6 X" Y0 s6 w: y else{
6 w" g) I) G4 S) a, Q3 {# O, S+ ` I = 0;( X& F! q& }& O* C, R, G8 V
}3 [0 \/ y% M/ I4 L- X# B* F
moneyspace.putObjectAt(x, y, new Integer(I+1)); }
4 D8 n5 M- I# s5 a } |
|