|
|

楼主 |
发表于 2012-3-6 09:15:08
|
显示全部楼层
代码帖的有点乱,怎么都没人能帮忙看看呢? 9 y9 s0 b0 ~5 {4 m8 Y4 R, l
public void spreadmoney(int m){9 m9 y* v( t9 E9 L/ U1 c8 h
for(int i=0;i<m;i++){2 a3 j' z0 |* e- P2 A1 G- [- U
int x = (int)(Math.random()*(moneyspace.getSizeX()));
4 H, i7 { t% ?8 j2 X& @ int y = (int)(Math.random()*(moneyspace.getSizeY()));/ J+ R [5 @2 v
+ B+ Y! a* g. v q$ {
int I;
1 |# B$ G$ ^& l) o& N5 l if(moneyspace.getObjectAt(x,y)!=null
! T/ r; K, x9 Z9 A I = ((Integer)moneyspace.getObjectAt(x,y)).intValue();$ C* z5 \ s7 B# o! f+ a
}
% f! ]* d" O. U: \/ [) {3 ~ else{) s" s5 W$ ~7 T4 T2 {7 g1 W
I = 0;
# _4 L- H" d7 j8 t. T; S }
7 p [+ M; X& n" ~7 \* q moneyspace.putObjectAt(x, y, new Integer(I+1)); }1 U+ H/ C7 X- `% B, f! M
} |
|