|
|

楼主 |
发表于 2012-3-6 09:15:08
|
显示全部楼层
代码帖的有点乱,怎么都没人能帮忙看看呢?
# c( Q% S4 Z4 @ public void spreadmoney(int m){; V+ L1 ?* h6 p1 C/ a
for(int i=0;i<m;i++){8 T8 U# @4 r, E% M' {1 _( `
int x = (int)(Math.random()*(moneyspace.getSizeX()));
" G. L! M9 z* M4 O int y = (int)(Math.random()*(moneyspace.getSizeY()));
& X6 C* z2 U0 h4 {
/ Q: ~7 n" Z9 Q+ R int I;
! g9 B' z+ B' c if(moneyspace.getObjectAt(x,y)!=null
2 Q( b8 c# E8 U7 J6 S I = ((Integer)moneyspace.getObjectAt(x,y)).intValue();. Z" L9 U4 z$ d$ Z
} x. n% |1 j, ^+ C5 x# g6 l
else{
3 |$ _5 i! l$ p# c/ ~ I = 0;
9 H) B# B6 e" A- z2 Y2 S }
; L0 N" B5 h2 p# b0 ~ moneyspace.putObjectAt(x, y, new Integer(I+1)); }
0 z; k, k( S0 ` } |
|