|
|

楼主 |
发表于 2012-3-6 09:15:08
|
显示全部楼层
代码帖的有点乱,怎么都没人能帮忙看看呢?
, _' x. c, r* y0 a public void spreadmoney(int m){; @7 K7 H: O5 n# e; m
for(int i=0;i<m;i++){" H7 j8 K$ R$ V
int x = (int)(Math.random()*(moneyspace.getSizeX()));
. w; b, a$ g0 E" b& E. b int y = (int)(Math.random()*(moneyspace.getSizeY()));/ d R1 w+ r& @# b! Y3 ^
* X: @8 ~" S% [/ x* T/ F int I; F! \0 H1 v1 ?9 O& C
if(moneyspace.getObjectAt(x,y)!=null
$ E2 D T/ [# E$ O* p8 r' K I = ((Integer)moneyspace.getObjectAt(x,y)).intValue();& L9 j! Q* e7 ~, d. i* C! o( B
}
1 z/ k) @ m0 @& ~/ H else{
5 Z( P, Y. N1 l I = 0;
; J5 h8 r# \# B; T: U& S0 X% L: _ }4 `/ I3 M+ Y9 M3 D
moneyspace.putObjectAt(x, y, new Integer(I+1)); }2 z0 |, x, ]5 `# f0 g: P
} |
|