|
|

楼主 |
发表于 2012-3-6 09:15:08
|
显示全部楼层
代码帖的有点乱,怎么都没人能帮忙看看呢?
6 Z' r# G/ {( ^ public void spreadmoney(int m){
' b7 E! [4 @+ b$ f2 { D for(int i=0;i<m;i++){
% j$ P6 O. M% m int x = (int)(Math.random()*(moneyspace.getSizeX()));
. q5 F) ?+ t' U* _4 G/ A5 a3 \7 Z int y = (int)(Math.random()*(moneyspace.getSizeY()));
. T e4 o2 r0 ? O: O0 K2 R3 w& a
% z' H2 {" w! f2 p3 ?1 E8 G! {+ D8 G int I;
, i( p% Z$ ]: k) [! W3 [ if(moneyspace.getObjectAt(x,y)!=null 3 f6 }& F. X9 R; @8 [9 ~
I = ((Integer)moneyspace.getObjectAt(x,y)).intValue();$ \& J+ t! z& F6 q
} P* F x9 M# e
else{1 B: ?; @5 V3 }" R
I = 0;
6 J5 u6 k# q, Q' f( p& Z* ? }
- D1 N- y5 @( ^6 k moneyspace.putObjectAt(x, y, new Integer(I+1)); }. @2 \( H6 S, Q* P4 f7 k3 u5 \
} |
|