|
|

楼主 |
发表于 2012-3-6 09:15:08
|
显示全部楼层
代码帖的有点乱,怎么都没人能帮忙看看呢? 2 p" }, D# c, h( M
public void spreadmoney(int m){4 d& p6 ^) y$ @+ C4 H& m
for(int i=0;i<m;i++){
8 m# A, p# ]- S3 l int x = (int)(Math.random()*(moneyspace.getSizeX()));) C+ D# S4 a: [, J5 M* h
int y = (int)(Math.random()*(moneyspace.getSizeY())); E) l1 m J2 j# }( Q" H3 Y5 A8 V
5 B8 z0 P# @1 ~& p0 _ int I;
; ?) F# k4 f, C if(moneyspace.getObjectAt(x,y)!=null 6 w/ ~5 g' H9 \% A
I = ((Integer)moneyspace.getObjectAt(x,y)).intValue();
) C2 h0 Y2 O! Y- e }! A# H2 N W4 S `1 R
else{
; q; W* y# r b I = 0;
6 A1 ` U( M. q. i* m' i& ] }; v5 w8 I/ K5 w# D5 K) M
moneyspace.putObjectAt(x, y, new Integer(I+1)); }6 v8 Q8 Q& }+ `5 C
} |
|