|
|

楼主 |
发表于 2012-3-6 09:15:08
|
显示全部楼层
代码帖的有点乱,怎么都没人能帮忙看看呢?
6 u& {2 _" f) ` public void spreadmoney(int m){
6 [) D9 K8 H- N# _# @3 H+ W for(int i=0;i<m;i++){& j) x$ q% N7 l) l8 y- q+ B" I
int x = (int)(Math.random()*(moneyspace.getSizeX()));" R+ F. k/ a7 H( ?, a
int y = (int)(Math.random()*(moneyspace.getSizeY()));
: v& j" _: a# \5 p8 C, H/ c/ @* l% w* ?' C3 n/ X1 f! {5 u$ a: y
int I; @8 Q- `. [2 L" p( y4 |
if(moneyspace.getObjectAt(x,y)!=null
' u7 \5 M2 P1 ~ I = ((Integer)moneyspace.getObjectAt(x,y)).intValue();
9 I: @+ D7 H3 K* E ^ }
# `& B, Z) e- V; v# y else{& a# d2 W; s( D/ n: w8 [; a
I = 0;, A$ K) s8 \; T* ^; Z ^ b
}
/ O) k' E8 r6 T9 U) j moneyspace.putObjectAt(x, y, new Integer(I+1)); }, \& d \& f2 Y) T# j8 h
} |
|