|
|

楼主 |
发表于 2012-3-6 09:15:08
|
显示全部楼层
代码帖的有点乱,怎么都没人能帮忙看看呢?
, o+ }: G( A4 B, k& p- N8 V public void spreadmoney(int m){! B; D! f7 {3 |; B4 q# r4 x7 l
for(int i=0;i<m;i++){" P0 i) ?0 O; \# D" W: w Y1 h
int x = (int)(Math.random()*(moneyspace.getSizeX()));5 u1 g; x5 D: K. [
int y = (int)(Math.random()*(moneyspace.getSizeY()));
1 R8 e. R3 g; C8 e8 z% c
- n0 O& D+ c: O# U$ x int I;, y# D# {4 P9 L7 j( C2 {* h/ _
if(moneyspace.getObjectAt(x,y)!=null 9 R( ^3 z9 _- J$ c# h" i$ \$ f0 ?6 g! p
I = ((Integer)moneyspace.getObjectAt(x,y)).intValue();# A! S Q2 r) x* l5 R% S
}. u. q* v% i# x2 \4 Q$ u! r
else{9 \- q, n/ Y2 p9 h; n( k
I = 0;
2 ?, Q7 [0 @# I G( i. j }3 ]6 ~- u! P7 i0 {( ]; w9 r
moneyspace.putObjectAt(x, y, new Integer(I+1)); }
. }& c; X" z, x, x. y } |
|