13,201,452 members (73,512 online)

# Welcome to the Lounge

The Lounge is rated PG. If you're about to post something you wouldn't want your kid sister to read then don't post it. No flame wars, no abusive conduct, no programming questions and please don't post ads.

 Re: Chinese hackers! MehGerbil11-Jan-13 2:22 MehGerbil 11-Jan-13 2:22
 Re: Chinese hackers! Mark_Wallace11-Jan-13 2:36 Mark_Wallace 11-Jan-13 2:36
 Re: Chinese hackers! Chris Losinger10-Jan-13 10:18 Chris Losinger 10-Jan-13 10:18
 Re: Chinese hackers! Roger Wright10-Jan-13 11:24 Roger Wright 10-Jan-13 11:24
 Re: Chinese hackers! AspDotNetDev10-Jan-13 11:33 AspDotNetDev 10-Jan-13 11:33
 Re: Chinese hackers! Chris Losinger10-Jan-13 11:52 Chris Losinger 10-Jan-13 11:52
 Re: Chinese hackers! AspDotNetDev10-Jan-13 11:58 AspDotNetDev 10-Jan-13 11:58
 Re: Chinese hackers! Roger Wright10-Jan-13 18:01 Roger Wright 10-Jan-13 18:01
 Re: Chinese hackers! Roger Wright10-Jan-13 17:59 Roger Wright 10-Jan-13 17:59
 Re: Chinese hackers! Mark_Wallace10-Jan-13 20:31 Mark_Wallace 10-Jan-13 20:31
 Re: Chinese hackers! Mark_Wallace10-Jan-13 20:50 Mark_Wallace 10-Jan-13 20:50
 Re: Chinese hackers! Marco Bertschi11-Jan-13 1:17 Marco Bertschi 11-Jan-13 1:17
 The first descent code I wrote in my life Vasily Tserekh10-Jan-13 6:57 Vasily Tserekh 10-Jan-13 6:57
 This is the first descent code I wrote when I began to make programs, it was in C++ Is about an algorithm to arrangle ships in a classic battleship game, first funcion is to check if a ship can be placed at x;y second is for placing the ship and 3th was for placing all the ships. I was so amazed that the code worked that I felt a joy I only felt few times since then. How about you ```//------Check if in square X;Y a ship can be placed------------------   /* x,y: Board coordinates Size: Ship size Pos: posicion (1 horizontal vertical) board: board number */ bool TGame::Free(int x,int y,int size,int pos,int board ) { int ship[7]; int side1[7]; int side2[7]; bool answer=true; if(aBoard[board]->GetInfo(x,y)!=0) { return answer=false; } if (pos==1) { for(int i=0;iGetInfo(x-1+i,y); side1[i]=aBoard[board]->GetInfo(x-1+i,y-1); side2[i]=aBoard[board]->GetInfo(x-1+i,y+1); } }   else { for(int i=0;iGetInfo(x,y-1+i); side1[i]=aBoard[board]->GetInfo(x-1,y-1+i); side2[i]=aBoard[board]->GetInfo(x+1,y-1+i); } } if (x==0 && pos==1) {ship[0]=0; side1[0]=0; side2[0]=0;   } for (int i=0;iSetInfo(x+i,y,type); } } else { while (answer==false) { x=random(10); y=random(16)-size; while(y<0) {y=random(16)-size; } answer=Free(x,y,size,pos,board); } for(int i=0;iSetInfo(x,y+i,type); } } if(board==0) { int ax=Transform(x); int ay=Transform(y); aPosXY[ship].x=ax; aPosXY[ship].y=ay; aPosXY[ship].pos=pos; }   } //----Posiciona todos los barcos en el tablero------------------------------   void TGame::RandomAllocation(int board) { RandomShip(5,6,board,0); RandomShip(4,5,board,1); RandomShip(3,4,board,2); RandomShip(3,3,board,3); RandomShip(2,2,board,4); RandomShip(2,1,board,5); } //---------------------------------------------------------------------------```
 Re: The first descent code I wrote in my life Richard Deeming10-Jan-13 7:11 Richard Deeming 10-Jan-13 7:11
 Re: The first descent code I wrote in my life mla15410-Jan-13 7:24 mla154 10-Jan-13 7:24
 Re: The first descent code I wrote in my life Member 460889812-Jan-13 22:52 Member 4608898 12-Jan-13 22:52
 Re: The first descent code I wrote in my life Roger Wright10-Jan-13 7:12 Roger Wright 10-Jan-13 7:12
 Re: The first descent code I wrote in my life Gary Wheeler10-Jan-13 8:11 Gary Wheeler 10-Jan-13 8:11
 Re: The first descent code I wrote in my life Roger Wright10-Jan-13 8:26 Roger Wright 10-Jan-13 8:26
 Re: The first descent code I wrote in my life Gary Wheeler10-Jan-13 8:35 Gary Wheeler 10-Jan-13 8:35
 Re: The first descent code I wrote in my life Roger Wright10-Jan-13 9:49 Roger Wright 10-Jan-13 9:49
 Re: The first descent code I wrote in my life Gary Wheeler10-Jan-13 10:16 Gary Wheeler 10-Jan-13 10:16
 Re: The first descent code I wrote in my life Roger Wright10-Jan-13 10:35 Roger Wright 10-Jan-13 10:35
 Re: The first descent code I wrote in my life Mathlab10-Jan-13 7:15 Mathlab 10-Jan-13 7:15
 Re: The first descent code I wrote in my life Ravi Bhavnani10-Jan-13 7:16 Ravi Bhavnani 10-Jan-13 7:16
 Re: The first descent code I wrote in my life MehGerbil10-Jan-13 7:24 MehGerbil 10-Jan-13 7:24
 Re: The first descent code I wrote in my life Chris Maunder10-Jan-13 9:44 Chris Maunder 10-Jan-13 9:44
 Re: The first descent code I wrote in my life _Maxxx_10-Jan-13 10:09 _Maxxx_ 10-Jan-13 10:09
 Re: The first descent code I wrote in my life Vasily Tserekh10-Jan-13 10:13 Vasily Tserekh 10-Jan-13 10:13
 Re: The first descent code I wrote in my life PIEBALDconsult10-Jan-13 7:56 PIEBALDconsult 10-Jan-13 7:56
 Re: The first descent code I wrote in my life Keith Barrow10-Jan-13 10:00 Keith Barrow 10-Jan-13 10:00
 Re: The first descent code I wrote in my life Roger Wright10-Jan-13 11:29 Roger Wright 10-Jan-13 11:29
 Re: The first descent code I wrote in my life PIEBALDconsult10-Jan-13 13:54 PIEBALDconsult 10-Jan-13 13:54
 Re: The first descent code I wrote in my life Roger Wright10-Jan-13 17:12 Roger Wright 10-Jan-13 17:12
 Re: The first descent code I wrote in my life Ranjan.D11-Jan-13 7:53 Ranjan.D 11-Jan-13 7:53
 Re: The first descent code I wrote in my life Judah Himango10-Jan-13 7:59 Judah Himango 10-Jan-13 7:59
 Re: The first descent code I wrote in my life Ennis Ray Lynch, Jr.10-Jan-13 8:19 Ennis Ray Lynch, Jr. 10-Jan-13 8:19
 Re: The first descent code I wrote in my life Vasily Tserekh10-Jan-13 8:51 Vasily Tserekh 10-Jan-13 8:51
 Re: The first descent code I wrote in my life Pete O'Hanlon10-Jan-13 9:21 Pete O'Hanlon 10-Jan-13 9:21
 Re: The first descent code I wrote in my life Andrew Rissing10-Jan-13 9:29 Andrew Rissing 10-Jan-13 9:29
 Re: The first descent code I wrote in my life Mark_Wallace10-Jan-13 20:34 Mark_Wallace 10-Jan-13 20:34
 Re: The first descent code I wrote in my life Clumpco10-Jan-13 22:24 Clumpco 10-Jan-13 22:24
 Re: The first descent code I wrote in my life Jecc10-Jan-13 23:15 Jecc 10-Jan-13 23:15
 Re: The first descent code I wrote in my life Fran Porretto11-Jan-13 0:59 Fran Porretto 11-Jan-13 0:59
 Re: The first descent code I wrote in my life pontellen11-Jan-13 3:17 pontellen 11-Jan-13 3:17
 Re: The first descent code I wrote in my life Reese Currie11-Jan-13 3:45 Reese Currie 11-Jan-13 3:45
 Re: The first descent code I wrote in my life PIEBALDconsult11-Jan-13 3:58 PIEBALDconsult 11-Jan-13 3:58
 Re: The first descent code I wrote in my life Reese Currie11-Jan-13 7:32 Reese Currie 11-Jan-13 7:32
 Re: The first descent code I wrote in my life BrainiacV11-Jan-13 3:47 BrainiacV 11-Jan-13 3:47
 Last Visit: 31-Dec-99 18:00     Last Update: 23-Oct-17 8:03 Refresh « Prev1...6922692369246925692669276928692969306931 Next »