|
|

楼主 |
发表于 2012-3-6 09:15:08
|
显示全部楼层
代码帖的有点乱,怎么都没人能帮忙看看呢? ' m: ` _) Q/ y, w( t7 G
public void spreadmoney(int m){0 [ K$ B- F, t5 ]
for(int i=0;i<m;i++){
- y& G; m5 J/ Z2 L int x = (int)(Math.random()*(moneyspace.getSizeX()));& f+ T" E! I: w0 W0 Q7 W- C5 R
int y = (int)(Math.random()*(moneyspace.getSizeY()));8 D$ a {- D1 Q, c/ l$ U) E6 ~8 ?
# [# D" F; j" Q; B- v2 [ int I;
" a2 E; q/ _6 N1 S0 P if(moneyspace.getObjectAt(x,y)!=null 0 c2 N7 V3 U4 ~
I = ((Integer)moneyspace.getObjectAt(x,y)).intValue();6 Y$ \) V/ l* E6 G% i- i6 G
}
3 B E; s* W' f& t else{# S; c8 @6 y B+ m4 e+ u
I = 0;* _" U8 h- H7 n. D1 r; {8 A) U
}
+ C+ g9 S7 J) { moneyspace.putObjectAt(x, y, new Integer(I+1)); }$ p" [& f l/ P/ P$ i& f
} |
|