|
|

楼主 |
发表于 2012-3-6 09:15:08
|
显示全部楼层
代码帖的有点乱,怎么都没人能帮忙看看呢?
) H! C8 `: @. s) o* L public void spreadmoney(int m){
. H m. n2 p6 C6 o/ i6 i% D for(int i=0;i<m;i++){$ d& ]! R: s; F1 K8 O+ ^' c5 X6 @
int x = (int)(Math.random()*(moneyspace.getSizeX()));. l6 Q* v- f. `! J! N. s7 z; e
int y = (int)(Math.random()*(moneyspace.getSizeY()));3 M+ a" y, I9 X
+ d* [$ c5 `% R6 U% i9 A8 t int I;
2 U5 i3 E% K- m6 I if(moneyspace.getObjectAt(x,y)!=null
; f$ @; _# g& |+ H' b I = ((Integer)moneyspace.getObjectAt(x,y)).intValue();
) y# j2 A8 } C9 m9 S1 M }- O$ I b7 O k3 i& H3 J/ v% L; a1 y
else{
3 b; `; w8 W- O I = 0;
; p' W& _4 G) t- F }
, Z0 a$ o8 q4 y- I9 S; \* M moneyspace.putObjectAt(x, y, new Integer(I+1)); }
& ^ s1 m% A4 }: j- ? } |
|