|
|

楼主 |
发表于 2012-3-6 09:15:08
|
显示全部楼层
代码帖的有点乱,怎么都没人能帮忙看看呢? ; g0 I- h) A' Y! x) K
public void spreadmoney(int m){
% u: [% L* P2 N/ A4 V) M. B for(int i=0;i<m;i++){) b! y+ I4 `/ M+ Z1 Z6 S
int x = (int)(Math.random()*(moneyspace.getSizeX()));; m5 m# G5 y7 t& p1 n) M+ X% D
int y = (int)(Math.random()*(moneyspace.getSizeY()));
/ m* M' G; p: I; a) P: W: m! }
. i4 Z- {1 p) G8 T. x3 ^ int I;5 R6 P; \, |* s6 L+ ?& }
if(moneyspace.getObjectAt(x,y)!=null
, n5 s |% q G0 R I = ((Integer)moneyspace.getObjectAt(x,y)).intValue();
$ e. L2 R- K( _& U1 X8 s }4 o [; S% x5 d8 u; o
else{
- D! c, r: Z% r- N, @# @ I = 0;
/ p. _) c- A4 p# V/ |: D }
( L) ^9 T7 C& _! b3 o7 a moneyspace.putObjectAt(x, y, new Integer(I+1)); }( _3 ? }! S" y7 t+ n+ R7 F
} |
|