|
|

楼主 |
发表于 2012-3-6 09:15:08
|
显示全部楼层
代码帖的有点乱,怎么都没人能帮忙看看呢?
) D) B3 M& F; f' m' C/ C& S public void spreadmoney(int m){
. K' }6 ?0 x) q+ B) H9 c% i for(int i=0;i<m;i++){
. ]8 v8 y* P, U5 Q5 i int x = (int)(Math.random()*(moneyspace.getSizeX()));
^' _( R; j$ `1 _ int y = (int)(Math.random()*(moneyspace.getSizeY()));
6 S* A& e4 F# t# g- B1 f# K4 v. Q6 s
int I;
7 K5 W9 f/ Z( _0 L5 h8 y. `. _, j if(moneyspace.getObjectAt(x,y)!=null 3 e0 K+ |) G; d6 Y' D" _6 R* Y3 l `
I = ((Integer)moneyspace.getObjectAt(x,y)).intValue();
- |( A+ O; G' a$ g$ I0 E9 l3 k }% ^* W/ T5 G: O) L0 X9 U( p
else{
: h1 b( I7 K7 H. L- U I = 0;
. T" A) B' {) s- i$ q }
4 p" a1 |$ ?8 z" n- K) R7 n moneyspace.putObjectAt(x, y, new Integer(I+1)); }& B( a. r; u6 O& b8 D
} |
|