|
|

楼主 |
发表于 2012-3-6 09:15:08
|
显示全部楼层
代码帖的有点乱,怎么都没人能帮忙看看呢?
* w0 H: L w$ _; W2 c5 J8 s. B" G public void spreadmoney(int m){
# H: k2 q7 r, \ for(int i=0;i<m;i++){
$ m: c# j8 r; [) s5 o int x = (int)(Math.random()*(moneyspace.getSizeX()));; l+ Y" X8 d h& t4 c$ P
int y = (int)(Math.random()*(moneyspace.getSizeY()));* n2 f& W5 m n7 e% E; ?; Z
1 S B9 q5 }& R( [2 b$ Z int I;
( W# G/ ^* C2 f( x! ~* p8 C1 J if(moneyspace.getObjectAt(x,y)!=null . W4 Z2 ^; y1 n$ w" L& @
I = ((Integer)moneyspace.getObjectAt(x,y)).intValue();
; n6 U3 x; q4 r% q" A* N6 I }3 d, F7 @' a0 O0 G
else{+ X. Q2 g, |! A2 c$ Y) A
I = 0;" G4 T3 Q, d/ U, T0 b' q, @' \/ w, w
}5 ?* D% t7 D1 v e0 l" Q' t
moneyspace.putObjectAt(x, y, new Integer(I+1)); }5 d# @. }5 D: O7 n2 u. X
} |
|