|
|

楼主 |
发表于 2012-3-6 09:15:08
|
显示全部楼层
代码帖的有点乱,怎么都没人能帮忙看看呢? . J0 e. q9 [. d
public void spreadmoney(int m){# f3 g& f+ P: @7 M6 a: F, W" m# ?
for(int i=0;i<m;i++){' |5 g9 s; z' j, j- o
int x = (int)(Math.random()*(moneyspace.getSizeX()));% Z- y) `3 k3 T8 B" J
int y = (int)(Math.random()*(moneyspace.getSizeY()));# l+ q$ M- M" |1 i: ~. s( V
) M5 J) p7 H+ j( J# T' C/ l! ^ int I;- ^( E4 c2 s/ ^/ e8 C3 F
if(moneyspace.getObjectAt(x,y)!=null
# ^7 m' C0 ]' N I = ((Integer)moneyspace.getObjectAt(x,y)).intValue();
8 s8 w/ x! N8 @ } }
, s+ [1 M2 q3 k9 q else{0 K: n6 O( W( Y5 ^* q4 X! t: b+ T8 ~
I = 0;
, V: r$ Q: B% K }
4 ^$ A6 z: K' s" c8 C moneyspace.putObjectAt(x, y, new Integer(I+1)); }, `4 `6 `& ? r) C) `) b
} |
|