|
|

楼主 |
发表于 2012-3-6 09:15:08
|
显示全部楼层
代码帖的有点乱,怎么都没人能帮忙看看呢?
6 K2 Z# u7 Z5 I0 F6 d" Q3 K* Y public void spreadmoney(int m){3 W6 @2 r# w/ A. H4 k# j4 [9 ?$ s
for(int i=0;i<m;i++){
" y) ?8 M# A, S( h1 @! z int x = (int)(Math.random()*(moneyspace.getSizeX()));
4 V* y5 Q/ f% n$ ~ int y = (int)(Math.random()*(moneyspace.getSizeY()));! d4 P7 F$ z/ u& @& s! u+ x5 w, L
: q7 \ ^' W( o1 _
int I;+ t7 u. |& G2 ^- L
if(moneyspace.getObjectAt(x,y)!=null
& s q6 O+ I C+ U" w/ t, V I = ((Integer)moneyspace.getObjectAt(x,y)).intValue();
8 W. {2 x9 F* ]. c' {( `! _# { }
4 n3 L9 j. d0 u& X7 C else{" ?. S5 [$ G) `: o; @1 e
I = 0;
! z5 s( |8 x. D9 R }. J- t" S. O& l3 F. N/ W& ]
moneyspace.putObjectAt(x, y, new Integer(I+1)); }
3 a6 T% \1 d' X3 }1 _$ s } |
|