|
|

楼主 |
发表于 2012-3-6 09:15:08
|
显示全部楼层
代码帖的有点乱,怎么都没人能帮忙看看呢? : G4 N; X- ^8 B, {2 H! w; y% g' {
public void spreadmoney(int m){1 \$ ^$ I h# z. e0 D$ C& v
for(int i=0;i<m;i++){- Q4 b9 f- X! k4 s
int x = (int)(Math.random()*(moneyspace.getSizeX()));
$ r4 q* d, G* L+ ^1 y: X2 Q9 E int y = (int)(Math.random()*(moneyspace.getSizeY()));+ w$ d1 s9 u# X0 g. z" K$ p9 C: V
5 X' G' R2 R# {: }: L6 X
int I;
: \8 [- _1 K! r# Q/ n if(moneyspace.getObjectAt(x,y)!=null
5 k0 O8 r3 g% |, r5 M I = ((Integer)moneyspace.getObjectAt(x,y)).intValue();
* F1 i7 q i5 L P- x }
: H0 h7 Y3 j# C: }2 J else{2 Y3 U: d2 {# e+ f5 E3 ]: n, b
I = 0; X0 ?. k4 A1 s6 w# O8 F
}
$ h4 x2 @3 J$ L# z+ M. t/ N; x moneyspace.putObjectAt(x, y, new Integer(I+1)); }
2 A0 i5 S1 j% N# U7 ~! l4 s } |
|