|

楼主 |
发表于 2012-3-6 09:15:08
|
显示全部楼层
代码帖的有点乱,怎么都没人能帮忙看看呢?
$ ]' |5 q: q$ k, S6 n/ ^4 g public void spreadmoney(int m){
7 ]4 h( t$ H/ E+ t& [+ q' ]$ ?; S for(int i=0;i<m;i++){
2 j$ w- Z1 @; \0 e int x = (int)(Math.random()*(moneyspace.getSizeX()));
8 s. c+ d& C. V int y = (int)(Math.random()*(moneyspace.getSizeY()));3 q; f0 Y5 {, Y" z- k
0 V9 I) F% r4 f6 G int I;+ w+ S4 n; m' c0 A: J$ V" k4 R
if(moneyspace.getObjectAt(x,y)!=null 5 b0 N" b R0 q- G; Y) ^
I = ((Integer)moneyspace.getObjectAt(x,y)).intValue();
1 [& I1 b! ?1 P- `4 F$ d2 P }
/ W7 C, Q- F$ t9 R6 E: ^ else{! ^$ Z0 i2 Q) V9 s( v$ U
I = 0;
5 w1 R! t4 h- E6 K t }% }2 E0 Z u: j1 |( w
moneyspace.putObjectAt(x, y, new Integer(I+1)); }( R2 y" Q; j' T7 D+ s' e
} |
|