|
|

楼主 |
发表于 2012-3-6 09:15:08
|
显示全部楼层
代码帖的有点乱,怎么都没人能帮忙看看呢? & U c/ e/ F" ], u2 R8 a4 j% \
public void spreadmoney(int m){- l& g; E$ G% w# I4 E: i4 Q
for(int i=0;i<m;i++){5 a+ W9 K* j8 M2 `
int x = (int)(Math.random()*(moneyspace.getSizeX())); b, E0 Z) D" V- l
int y = (int)(Math.random()*(moneyspace.getSizeY()));
1 w. P' r5 Q+ H2 f$ G7 Q6 `( `& w- z, j6 Y) s- n
int I;4 v+ `6 T6 d t4 a& K. g. \
if(moneyspace.getObjectAt(x,y)!=null - D: r- f! \1 C2 C
I = ((Integer)moneyspace.getObjectAt(x,y)).intValue();$ W0 ] ~' l% u+ K4 Q, }
}% U; e' l: E# w* |" h' ?/ O* }
else{
( |3 `- F5 t6 [/ f I = 0;/ `/ i# |9 L+ s7 h0 I
}7 r) i/ `4 t1 Q, L
moneyspace.putObjectAt(x, y, new Integer(I+1)); }2 _2 k& f W/ `3 ?* \) c5 {# s
} |
|