|
|

楼主 |
发表于 2012-3-6 09:15:08
|
显示全部楼层
代码帖的有点乱,怎么都没人能帮忙看看呢? $ N; i" i6 U- j! X' {
public void spreadmoney(int m){+ Y* D% Q* |' t" Y% [
for(int i=0;i<m;i++){3 W& Q( A3 d; i. e, y+ T+ C
int x = (int)(Math.random()*(moneyspace.getSizeX()));
* \1 S% B5 L! [6 q( I$ V int y = (int)(Math.random()*(moneyspace.getSizeY()));; A3 G6 @ {! N: O( F* P" g: d
# ~ J% ]% K. U( b( D% ?7 X1 y
int I;
6 b; e# o8 {. u; O3 L if(moneyspace.getObjectAt(x,y)!=null
+ C% D; _( ~+ ], ~9 V I = ((Integer)moneyspace.getObjectAt(x,y)).intValue();
8 l; y' e2 W' q }
9 K0 O7 G) {3 P ^) d& p else{
7 p: w% D9 Z( H; k' q; G I = 0; b; [" q3 J) e+ v! w
} E, j& B. M2 D2 y2 D
moneyspace.putObjectAt(x, y, new Integer(I+1)); } N) O. x, i* ^
} |
|