|
|

楼主 |
发表于 2012-3-6 09:15:08
|
显示全部楼层
代码帖的有点乱,怎么都没人能帮忙看看呢?
2 N$ L0 Z4 o2 o public void spreadmoney(int m){) R( t' c- A/ B! x8 Y2 z4 Z; E
for(int i=0;i<m;i++){
2 [5 i5 O6 f* X- ?" u int x = (int)(Math.random()*(moneyspace.getSizeX()));
" C& t1 n" Y+ t; f6 z int y = (int)(Math.random()*(moneyspace.getSizeY()));. Z) D1 K8 A9 [
, Y2 |; Q! G% l' F4 H9 p$ } int I;- B6 s9 {8 L6 B) I" O0 Q
if(moneyspace.getObjectAt(x,y)!=null
`' E3 U8 S. g2 M I = ((Integer)moneyspace.getObjectAt(x,y)).intValue();
8 q9 G$ ~7 Y3 K& y }
8 M, [4 K! [; ^2 h6 `( _ else{* D( f- M. G8 _9 k" a- u% R- G* i+ R, ?' V
I = 0;1 L% a3 O$ g- b, ~! S4 U; N& ?
}
0 B# e7 U/ s1 u0 d+ u4 g moneyspace.putObjectAt(x, y, new Integer(I+1)); }
1 T6 x- |1 K6 d+ B } |
|