home bbs files messages ]

Forums before death by AOL, social media and spammers... "We can't have nice things"

   comp.lang.pascal.borland      Borland Pascal was actually pretty neat      2,978 messages   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]

   Message 2,369 of 2,978   
   Bart to All   
   How to rotate a 2D array?   
   06 Jan 07 20:17:33   
   
   From: broersma.juda_ANTISPAM_@tiscali.nl   
      
   Hi,   
      
   I have a 2 dimensional array that represent cells on a board.   
   It is declared something like this:   
      
   array[0..MaxX, 0..MaxY] of TCell;   
      
   Basically a TCell represents (a.o.) the state of the cell, either Dead   
   or Alive.   
   (It's yet another Game of Life version)   
      
   Now I want to rotate the board (90 degrees for starters)   
   So here's one board with cells (0 = Alive, - = Dead)   
      
      
   ----------   
   -0--------   
   -0--------   
   -0--------   
   -0000-----   
   ----------   
   ----------   
   ----------   
   ----------   
   ----------   
   And this is how it should look after the 90 degree rotation:   
      
      
   -----0000-   
   -----0----   
   -----0----   
   -----0----   
   ----------   
   ----------   
   ----------   
   ----------   
   ----------   
   ----------   
      
   How can this be achieved?   
      
   Bart   
   --   
   Bart Broersma   
   broersma.juda_ANTISPAM_@tiscali.nl   
   (ff _ANTISPAM_ wegpoetsen uit dit adres natuurlijk)   
      
   --- SoupGate-Win32 v1.05   
    * Origin: you cannot sedate... all the things you hate (1:229/2)   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]


(c) 1994,  bbs@darkrealms.ca