|
|

楼主 |
发表于 2012-3-6 09:15:08
|
显示全部楼层
代码帖的有点乱,怎么都没人能帮忙看看呢? 9 a6 G n3 o1 W! ^) R( ?4 ]. e
public void spreadmoney(int m){
# b2 g: P8 N. e+ M( g for(int i=0;i<m;i++){
% r3 u5 F. @6 c* X. i: ]. N3 d" i* S int x = (int)(Math.random()*(moneyspace.getSizeX()));& ~+ P9 S$ y1 a' k3 E- {1 H9 D
int y = (int)(Math.random()*(moneyspace.getSizeY()));% H1 X/ F6 ^% J0 e9 N! N1 B
6 _1 @8 d: C+ Y3 u, M( D int I;" |! b6 w9 i M1 i1 t$ R. W) E H1 f% l
if(moneyspace.getObjectAt(x,y)!=null ' `: `# X2 d) N, Y4 l p6 k
I = ((Integer)moneyspace.getObjectAt(x,y)).intValue();: Q1 s2 ]$ c& S( C5 \ \
}4 h! x- `. o. Y; d( \- B
else{8 n9 Q2 }5 C- h
I = 0;$ b3 F0 U( B/ Z ] l, O1 @
}
- w+ c1 ?( }0 U0 ~1 S moneyspace.putObjectAt(x, y, new Integer(I+1)); }; U6 ^ t$ n/ N+ v- x
} |
|