|
楼主 |
发表于 2012-3-6 09:15:08
|
显示全部楼层
代码帖的有点乱,怎么都没人能帮忙看看呢? 4 l, S# G: y% v8 Y' F
public void spreadmoney(int m){, ~4 G. Y2 x7 i, i( }# s0 P! f
for(int i=0;i<m;i++){
. k3 i0 T% v4 |4 @) O& q6 g int x = (int)(Math.random()*(moneyspace.getSizeX()));7 R' X' V) f$ t7 w: x- Z( \
int y = (int)(Math.random()*(moneyspace.getSizeY()));$ M& C. ?% @- {& K0 x5 b
, D) N) O" M/ U- s. o: W8 k, U3 e int I;1 o+ F! n7 N0 o, _6 w4 I5 l
if(moneyspace.getObjectAt(x,y)!=null
3 Y9 z! x6 X( a" L! q! P I = ((Integer)moneyspace.getObjectAt(x,y)).intValue();
! K1 b+ c+ d+ C. ^! l8 a. S; | }/ j+ O; P# Q5 v6 `7 C* s3 a0 I# \
else{) h& r( E j5 q8 E2 o7 e
I = 0;
: s# s( T( }( A. { }2 ?. Y0 y6 Y/ k2 W6 b2 r e U* s
moneyspace.putObjectAt(x, y, new Integer(I+1)); }5 O# o3 U2 ^0 ~- S- E" A
} |
|