|
|

楼主 |
发表于 2012-3-6 09:15:08
|
显示全部楼层
代码帖的有点乱,怎么都没人能帮忙看看呢?
3 d6 M! |$ Y; n: T. O) o `4 _ public void spreadmoney(int m){9 h8 J7 T8 N8 o: P8 a
for(int i=0;i<m;i++){3 e+ ~& z `8 J$ i3 F
int x = (int)(Math.random()*(moneyspace.getSizeX()));% Y- a, ]0 d8 }) O. m- U+ {
int y = (int)(Math.random()*(moneyspace.getSizeY()));! F U; T9 C4 l: Z, Q
7 i, V7 l W# c7 N/ g int I;
, C- o' y# c. Y if(moneyspace.getObjectAt(x,y)!=null ' [; o" O% e, L7 s4 {
I = ((Integer)moneyspace.getObjectAt(x,y)).intValue();7 Z& N5 C% G( B( o
}
% W! i% }5 [- {' [8 V8 \ else{
3 x3 _& C# c! d+ u I = 0;
2 \# e8 a9 q7 O3 F+ [ }8 z& N1 P% d# x
moneyspace.putObjectAt(x, y, new Integer(I+1)); }( O7 {. W( D( @, j" a5 y6 t
} |
|