|
|

楼主 |
发表于 2012-3-6 09:15:08
|
显示全部楼层
代码帖的有点乱,怎么都没人能帮忙看看呢?
% c0 N. g4 J5 e! Y+ p/ g4 n public void spreadmoney(int m){
; v7 M' r2 g1 b4 _ for(int i=0;i<m;i++){7 D% v/ s" n: p8 s; h) l( x
int x = (int)(Math.random()*(moneyspace.getSizeX()));
" u+ S' w* _+ f7 }* K int y = (int)(Math.random()*(moneyspace.getSizeY()));
; E: U- E# ?0 o2 l" Y- ?1 o& ^* E) j6 i o, {# a/ n$ {9 J9 `1 T& M r
int I;& A& o) T" |" q3 B) ]
if(moneyspace.getObjectAt(x,y)!=null
4 S7 ~* r9 a9 |0 y+ A6 ?8 W2 M u I = ((Integer)moneyspace.getObjectAt(x,y)).intValue();- b/ {( h6 k5 L' h8 s. m# t
}8 t" J) E. T) U1 w X( {7 j
else{
* N5 l* N) L# R! f$ C. P' j9 H2 _ I = 0;
1 r7 W1 O2 w% W }% Y7 |5 d4 Y9 ^, p
moneyspace.putObjectAt(x, y, new Integer(I+1)); }
) N. Y% K' ?6 ]9 e0 v4 S" r } |
|