[Gambas-user] Stranges mines

 [Gambas-user] Stranges mines From: Pozzo - 2004-02-28 20:28:56 ```Hi All, I'm writing a Mines Hunter game under Gambas and I've found a real strange thing. first I have realize a Sub that place mines randomly, it works fine but is too complicated, I'll modify it in another time, I already now what to do :-), for tensting propose it put only two mines in an array of 128 cells then I've created a sub that check all then cells next to one cell per time so I can know how many mines are near to it, the cells with the mine are true and the cells without are false and here is the problem, the first time the sub find a mine everything is OK but at the next cicle a mine born magicaly in the cell at the right of the cell I'm woring on. For example if the mines are in the cells 1,1 and 7,2 when I'm working on the 0,0 it find a mine at the 1,1 and this is OK the I move to the 0,1 and it find a mine in the 1,1 and in the 0,2 next time it find in the 1,1, the 0,2 and the 0,3 .... this is real strange because I never modify the array during the process this is my sub where we(7) and hi(15) are indicate how many cells there are in the array, Harry is the array with all the mines and HarryC is the array where i've writen how many mines are near to the cells. SUB control (We AS Integer, Hi AS Integer) DIM i AS Integer DIM j AS Integer DIM y AS Integer DIM t AS Integer DIM c AS Integer DIM debug AS Boolean FOR i=0 TO Hi FOR j=0 TO We c = 0 FOR y =i-1 TO i+1 FOR t=j-1 TO j+1 debug = false IF t<0 OR t>We OR y<0 OR y>Hi THEN ELSE IF Harry[t,y] = true THEN c = c + 1 ENDIF ENDIF NEXT NEXT IF Harry[j,i] = false THEN HarryC[j,i] = c ELSE HarryC[j,i]= 80011 ENDIF NEXT NEXT END Maurizio ```

 [Gambas-user] Stranges mines From: Pozzo - 2004-02-28 20:28:56 ```Hi All, I'm writing a Mines Hunter game under Gambas and I've found a real strange thing. first I have realize a Sub that place mines randomly, it works fine but is too complicated, I'll modify it in another time, I already now what to do :-), for tensting propose it put only two mines in an array of 128 cells then I've created a sub that check all then cells next to one cell per time so I can know how many mines are near to it, the cells with the mine are true and the cells without are false and here is the problem, the first time the sub find a mine everything is OK but at the next cicle a mine born magicaly in the cell at the right of the cell I'm woring on. For example if the mines are in the cells 1,1 and 7,2 when I'm working on the 0,0 it find a mine at the 1,1 and this is OK the I move to the 0,1 and it find a mine in the 1,1 and in the 0,2 next time it find in the 1,1, the 0,2 and the 0,3 .... this is real strange because I never modify the array during the process this is my sub where we(7) and hi(15) are indicate how many cells there are in the array, Harry is the array with all the mines and HarryC is the array where i've writen how many mines are near to the cells. SUB control (We AS Integer, Hi AS Integer) DIM i AS Integer DIM j AS Integer DIM y AS Integer DIM t AS Integer DIM c AS Integer DIM debug AS Boolean FOR i=0 TO Hi FOR j=0 TO We c = 0 FOR y =i-1 TO i+1 FOR t=j-1 TO j+1 debug = false IF t<0 OR t>We OR y<0 OR y>Hi THEN ELSE IF Harry[t,y] = true THEN c = c + 1 ENDIF ENDIF NEXT NEXT IF Harry[j,i] = false THEN HarryC[j,i] = c ELSE HarryC[j,i]= 80011 ENDIF NEXT NEXT END Maurizio ```
 Re: [Gambas-user] Stranges mines From: Benoit Minisini - 2004-02-28 20:33:19 ```On Saturday 28 February 2004 21:25, Pozzo wrote: > Hi All, > I'm writing a Mines Hunter game under Gambas and I've found a real > strange thing. > first I have realize a Sub that place mines randomly, it works fine but > is too complicated, I'll modify it in another time, I already now what > to do :-), for tensting propose it put only two mines in an array of 128 > cells then I've created a sub that check all then cells next to one cell > per time so I can know how many mines are near to it, the cells with the > mine are true and the cells without are false and here is the problem, > the first time the sub find a mine everything is OK but at the next > cicle a mine born magicaly in the cell at the right of the cell I'm > woring on. > For example if the mines are in the cells 1,1 and 7,2 when I'm working > on the 0,0 it find a mine at the 1,1 and this is OK the I move to the > 0,1 and it find a mine in the 1,1 and in the 0,2 next time it find in > the 1,1, the 0,2 and the 0,3 .... > this is real strange because I never modify the array during the process > this is my sub where we(7) and hi(15) are indicate how many cells there > are in the array, Harry is the array with all the mines and HarryC is > the array where i've writen how many mines are near to the cells. > > SUB control (We AS Integer, Hi AS Integer) > > DIM i AS Integer > DIM j AS Integer > DIM y AS Integer > DIM t AS Integer > DIM c AS Integer > DIM debug AS Boolean > FOR i=0 TO Hi > FOR j=0 TO We > c = 0 > FOR y =i-1 TO i+1 > FOR t=j-1 TO j+1 > debug = false > IF t<0 OR t>We OR y<0 OR y>Hi THEN > ELSE > IF Harry[t,y] = true THEN > c = c + 1 > ENDIF > ENDIF > NEXT > NEXT > IF Harry[j,i] = false THEN > HarryC[j,i] = c > ELSE > HarryC[j,i]= 80011 > ENDIF > NEXT > NEXT > END > > > Maurizio > What are the declaration of the arrays ? Could you send me a complete project ? Regards, -- Benoit Minisini mailto:gambas@... ```
 [Gambas-user] re:Stranges mines From: Pozzo - 2004-03-01 19:59:56 ```Fabien Bodard ha scritto: > Le Dimanche 29 Février 2004 13:38, Pozzo a écrit : > > >> here it is >> > > ....hum!..... use picturebox.border property in place of your > buttons.... it don't change with the desktop thème. > > Fabien > > > Thank you for your suggestion now is easier to program, but I 'have one problem I would like to change the .border proprerty during the execution of the program and I tried something like this but it didn't work: Last.border = none Thank you Maurizio ```
 Re: [Gambas-user] re:Stranges mines From: Fabien Bodard - 2004-03-01 21:54:57 ```Le Lundi 1 Mars 2004 20:55, Pozzo a =E9crit : > Fabien Bodard ha scritto: > > Le Dimanche 29 F=E9vrier 2004 13:38, Pozzo a =E9crit : > >> here it is > > > > ....hum!..... use picturebox.border property in place of your > > buttons.... it don't change with the desktop th=E8me. > > > > Fabien > > Thank you for your suggestion now is easier to program, but I 'have one > problem I would like to change the .border proprerty during the > execution of the program and I tried something like this but it didn't > work: > > Last.border =3D none last.border =3D border.none see border object in the gb help > Thank you > > Maurizio > > > > ------------------------------------------------------- > SF.Net is sponsored by: Speed Start Your Linux Apps Now. > Build and deploy apps & Web services for Linux with > a free DVD software kit from IBM. Click Now! > http://ads.osdn.com/?ad_id=3D1356&alloc_id=3D3438&op=3Dclick > _______________________________________________ > Gambas-user mailing list > Gambas-user@... > https://lists.sourceforge.net/lists/listinfo/gambas-user ```