|
|

楼主 |
发表于 2012-3-6 09:15:08
|
显示全部楼层
代码帖的有点乱,怎么都没人能帮忙看看呢?
8 S. z: m6 {& L! I3 T public void spreadmoney(int m){
# |4 n0 k% Z* l+ e2 N- Z, m for(int i=0;i<m;i++){: [2 ~. a+ A& B" P
int x = (int)(Math.random()*(moneyspace.getSizeX()));0 E S1 j& s4 F
int y = (int)(Math.random()*(moneyspace.getSizeY()));
/ N" J- U. Y: S: t( R4 Q4 N7 S% Z' x; p5 M+ @! c" p+ M1 @0 k1 j8 @
int I;
" Q; o( u& S5 h if(moneyspace.getObjectAt(x,y)!=null $ }. \7 m3 w; @+ c4 Q% [: E: O
I = ((Integer)moneyspace.getObjectAt(x,y)).intValue();
, k+ O6 b2 c1 s5 L0 f. y }( k. L9 e: r+ S* A/ b& `# u
else{
8 U; F/ C l- y( `3 ~& p I = 0;' M9 N/ }) a" j3 \+ t
}5 O" p/ d% ^, e% I9 H- w. o
moneyspace.putObjectAt(x, y, new Integer(I+1)); }
. g, \& m" Y4 K4 D& G# C0 O/ f } |
|