|
|

楼主 |
发表于 2012-3-6 09:15:08
|
显示全部楼层
代码帖的有点乱,怎么都没人能帮忙看看呢? 9 g/ Z( ^/ j3 M
public void spreadmoney(int m){
* `" U2 L" K# K for(int i=0;i<m;i++){
5 x" R5 N, |% d- ?& x int x = (int)(Math.random()*(moneyspace.getSizeX()));
6 }. R" J; H3 G- e, c( @5 a. i; x( i int y = (int)(Math.random()*(moneyspace.getSizeY()));) |, q {4 \) g/ s) B, _
5 Y: ~8 f* ]8 d1 W0 j
int I;
. x! t) y4 z1 H8 u# W3 d) ]8 C if(moneyspace.getObjectAt(x,y)!=null
" \4 W) W3 ?) H/ m- { I = ((Integer)moneyspace.getObjectAt(x,y)).intValue();
7 |# `6 I, {, k# W/ V% h( g }
' D; V9 Q/ X2 A0 j7 P; v else{
2 g/ h, e8 t+ F X5 P5 i5 k' y* b C I = 0;
) }, n9 O2 D3 V' ^1 w1 H/ Y9 L/ [. } }! G* r/ ]" e( x7 {4 h: W
moneyspace.putObjectAt(x, y, new Integer(I+1)); }3 T. H) d* ~* T( E H: c9 ^0 k
} |
|