|
|

楼主 |
发表于 2012-3-6 09:15:08
|
显示全部楼层
代码帖的有点乱,怎么都没人能帮忙看看呢? , k0 [2 g$ h6 n2 T" \
public void spreadmoney(int m){* w, P" G! D# n. T/ v
for(int i=0;i<m;i++){
/ e( j0 R) o1 l& l! Y+ _' X int x = (int)(Math.random()*(moneyspace.getSizeX()));
, X; d1 K x: I5 ]1 q' e int y = (int)(Math.random()*(moneyspace.getSizeY()));' c5 o1 h. f: ]
1 T: M3 ~$ M' l" o2 o5 d4 K7 l
int I;
) ]( s% I1 y+ w4 b$ x( Y3 q3 Y if(moneyspace.getObjectAt(x,y)!=null $ i/ V* c" {. w2 ?8 y9 I2 D) {
I = ((Integer)moneyspace.getObjectAt(x,y)).intValue();: P4 |) X. c+ J% a9 X5 @; M) w
}- t/ U4 {8 o- L ?. V3 {$ I m
else{) J& C$ ^8 v8 v s# m( q
I = 0;; E1 b3 J* O- I* h, ~
}& A! ^! O: ?; I# ~9 P4 k
moneyspace.putObjectAt(x, y, new Integer(I+1)); }
! M6 N) k! P1 k } |
|