|
|

楼主 |
发表于 2012-3-6 09:15:08
|
显示全部楼层
代码帖的有点乱,怎么都没人能帮忙看看呢?
% u) b! f, I! s, T* N7 T9 } public void spreadmoney(int m){
3 s+ Y' y% h' v& I7 M! A) a2 Z for(int i=0;i<m;i++){# m8 m" q/ Q! ]$ _5 h3 K
int x = (int)(Math.random()*(moneyspace.getSizeX()));9 n; C' m, R$ M! H- I' `/ z) \" B
int y = (int)(Math.random()*(moneyspace.getSizeY()));
1 b+ t& L& L; o: n _2 ^
1 \( K0 _' _* h! ^- s$ T- {2 W int I;
! C8 q' ?8 \; k" j5 o9 {" V/ o! z if(moneyspace.getObjectAt(x,y)!=null
" p( x6 l) }: J I = ((Integer)moneyspace.getObjectAt(x,y)).intValue();0 W- t7 a+ E% M6 q
}3 d d# ?' u) ~8 g5 _4 y/ X0 G
else{5 m: K1 v' ^# Q* D# Q
I = 0;
5 S6 z' t8 O, t! I) l2 @ }$ u1 s4 C" Z, F5 u
moneyspace.putObjectAt(x, y, new Integer(I+1)); } D t9 y0 D6 Q }
} |
|