|
|

楼主 |
发表于 2012-3-6 09:15:08
|
显示全部楼层
代码帖的有点乱,怎么都没人能帮忙看看呢? # M' G; i' b% i6 B) X% S3 E7 W
public void spreadmoney(int m){% W; g$ v4 K3 P1 }
for(int i=0;i<m;i++){3 i' H4 q4 Q) C: l# _& M J
int x = (int)(Math.random()*(moneyspace.getSizeX()));% i- Q2 C& k7 P: N3 o8 q
int y = (int)(Math.random()*(moneyspace.getSizeY()));+ x1 B) p: T0 o: c. U
) X8 G) N! i5 Z9 O0 T, w0 I( I; _$ L' F int I;
6 x# D. `/ r' q, x# H8 P9 } if(moneyspace.getObjectAt(x,y)!=null
0 z* |% k1 @# h- W; { I = ((Integer)moneyspace.getObjectAt(x,y)).intValue();
% a% r* Y: ?: j! d3 j }
( x6 F+ _+ I* l L3 c& \4 [9 y5 p+ E else{, G/ l0 n; |" h* I9 w3 f+ S
I = 0;1 ]5 y, L6 \* [4 N0 q
}
9 X' U ~4 h9 u L9 P moneyspace.putObjectAt(x, y, new Integer(I+1)); }
' {, T8 n0 I* a$ V4 A6 [) C } |
|