|
|

楼主 |
发表于 2012-3-6 09:15:08
|
显示全部楼层
代码帖的有点乱,怎么都没人能帮忙看看呢? " q! b& K, ~# I. o3 }4 y* d1 e. I
public void spreadmoney(int m){: T# {; ~% F' A& `; a
for(int i=0;i<m;i++){: r! p* R3 J# N
int x = (int)(Math.random()*(moneyspace.getSizeX()));, d7 ~3 y8 A3 T2 ^+ ?( D
int y = (int)(Math.random()*(moneyspace.getSizeY()));, ?0 j4 x2 {5 `, P5 u
3 Q" r+ c3 M3 d1 g* Y int I;
2 w. X1 H5 a' M4 j: T if(moneyspace.getObjectAt(x,y)!=null $ B. W2 A9 e: I
I = ((Integer)moneyspace.getObjectAt(x,y)).intValue();9 ?5 N# s) }8 d- R* K* h6 q
}
$ l. C1 o" d, ]+ N* v8 c' C else{
% d Z5 J: L6 u$ F I = 0;* M4 Q5 G, K$ c! l% c2 |5 T9 g0 ?
}& n% _/ X7 D1 K) v% z, H
moneyspace.putObjectAt(x, y, new Integer(I+1)); }
0 I1 H8 @+ v* K% _ } |
|