|
|

楼主 |
发表于 2012-3-6 09:15:08
|
显示全部楼层
代码帖的有点乱,怎么都没人能帮忙看看呢?
4 T$ z6 x* |! s' E% B public void spreadmoney(int m){
% ?& y0 E' R$ G3 T for(int i=0;i<m;i++){% A; `; v" o* H2 \: H, r# m/ c+ t
int x = (int)(Math.random()*(moneyspace.getSizeX()));5 v6 r% P- U& w( ]; g% H! G S- T* C
int y = (int)(Math.random()*(moneyspace.getSizeY()));0 f* f( I; O: C! F1 \" P# s3 ^
2 V& g. \+ H1 b2 T+ }+ L' `
int I;" X& P; ?3 m6 K; a
if(moneyspace.getObjectAt(x,y)!=null % \ E( d! V9 u' _6 ~
I = ((Integer)moneyspace.getObjectAt(x,y)).intValue();
% h& y2 ^. E$ ^( H }0 k( n7 }/ M5 h9 I3 K# L
else{
* c2 _9 Q+ |" X4 {) U I = 0;
, ^) G7 r' N7 ?: G, D4 A }
6 I! r7 Y9 |+ c5 _7 J moneyspace.putObjectAt(x, y, new Integer(I+1)); }
7 Y& ^: f2 @9 {0 z } |
|