Recent

Author Topic: [SOLVED] How to convert this C++ code into Free Pascal  (Read 2132 times)

YiannisKam

  • Full Member
  • ***
  • Posts: 119
[SOLVED] How to convert this C++ code into Free Pascal
« on: February 07, 2024, 04:42:21 pm »
Hello, I'd like to convert the code below, preferably using vectors, can you help?
Code: C  [Select][+][-]
  1. std::vector<std::vector<int>> grid{
  2.         {0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0},
  3.         {0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0},
  4.         {0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0},
  5.         {0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0},
  6.         {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1},
  7.         {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1},
  8.         {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1},
  9.         {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1},
  10.         {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1},
  11.         {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1},
  12.         {1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1},
  13.         {1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1},
  14.         {1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1}
  15.         };
« Last Edit: February 07, 2024, 08:39:23 pm by YiannisKam »
Windows 10 - 64bit
Lazarus version: 3.99
FPC       version: 3.3.1

Fibonacci

  • Hero Member
  • *****
  • Posts: 943
  • Behold, I bring salvation - FPC Unleashed
Re: How to convert this C++ code into Free Pascal
« Reply #1 on: February 07, 2024, 04:46:36 pm »
Code: Pascal  [Select][+][-]
  1. var
  2.   grid: array[0..12, 0..22] of integer = (
  3.     (0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0),
  4.     (0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0),
  5.     (0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0),
  6.     (0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0),
  7.     (1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1),
  8.     (1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1),
  9.     (1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1),
  10.     (1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1),
  11.     (1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1),
  12.     (1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1),
  13.     (1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1),
  14.     (1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1),
  15.     (1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1)
  16.   );
FPC Unleashed - inline vars, tuples, statement expressions, array equality, compound assignments, indexed/lazy labels, no-RTTI & more. ⭐ Star it on GitHub!

YiannisKam

  • Full Member
  • ***
  • Posts: 119
Re: How to convert this C++ code into Free Pascal
« Reply #2 on: February 07, 2024, 04:50:01 pm »
That's easy. I'm want to imitate C++ vectors. Is it possible?
Windows 10 - 64bit
Lazarus version: 3.99
FPC       version: 3.3.1

Fibonacci

  • Hero Member
  • *****
  • Posts: 943
  • Behold, I bring salvation - FPC Unleashed
Re: How to convert this C++ code into Free Pascal
« Reply #3 on: February 07, 2024, 04:55:28 pm »
Code: Pascal  [Select][+][-]
  1. {$modeswitch arrayoperators}
  2.  
  3. var
  4.   grid: array of array of integer;
  5.   temp: array of integer;
  6.  
  7. begin
  8.   grid := [];
  9.   temp := [0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0]; grid += [temp];
  10.   temp := [0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0]; grid += [temp];
  11.   temp := [0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0]; grid += [temp];
  12.   temp := [0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0]; grid += [temp];
  13.   temp := [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]; grid += [temp];
  14.   temp := [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]; grid += [temp];
  15.   temp := [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]; grid += [temp];
  16.   temp := [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]; grid += [temp];
  17.   temp := [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]; grid += [temp];
  18.   temp := [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]; grid += [temp];
  19.   temp := [1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1]; grid += [temp];
  20.   temp := [1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1]; grid += [temp];
  21.   temp := [1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1]; grid += [temp];  
FPC Unleashed - inline vars, tuples, statement expressions, array equality, compound assignments, indexed/lazy labels, no-RTTI & more. ⭐ Star it on GitHub!

YiannisKam

  • Full Member
  • ***
  • Posts: 119
Re: How to convert this C++ code into Free Pascal
« Reply #4 on: February 07, 2024, 05:04:57 pm »
Here's my effort but after that I'm not sure how to pass the values
Code: Pascal  [Select][+][-]
  1. program project1;
  2.  
  3. {$mode objfpc}{$H+}
  4.  
  5. uses
  6.   gvector;
  7.  
  8. type TGridVector  = specialize TVector<specialize TVector<Integer>>;
  9.  
  10. var
  11.   Grid: TGridVector;
  12.  
  13. begin
  14.   Grid := TGridVector.Create;
  15.  
  16.   ReadLn;
  17. end.
  18.  
Windows 10 - 64bit
Lazarus version: 3.99
FPC       version: 3.3.1

Fibonacci

  • Hero Member
  • *****
  • Posts: 943
  • Behold, I bring salvation - FPC Unleashed
Re: How to convert this C++ code into Free Pascal
« Reply #5 on: February 07, 2024, 05:19:02 pm »
I guess with gvector unit it wont look as nice as in C++ vectors. Never used it before, so here is my first attempt:

Code: Pascal  [Select][+][-]
  1. uses gvector;
  2.  
  3. type
  4.   TGridVector  = specialize TVector<specialize TVector<Integer>>;
  5.   vofi = specialize TVector<Integer>;
  6.  
  7. var
  8.   grid: TGridVector;  
  9.   v: vofi;
  10.   y, x: integer;
  11.  
  12. begin
  13.   grid := TGridVector.Create;
  14.  
  15.   v := vofi.Create;
  16.   v.PushBack(1);
  17.   v.PushBack(2);
  18.   v.PushBack(3);
  19.   grid.PushBack(v);
  20.  
  21.   v := vofi.Create;
  22.   v.PushBack(91);
  23.   v.PushBack(92);
  24.   v.PushBack(93);  
  25.   grid.PushBack(v);
  26.  
  27.   for y := 0 to grid.Size-1 do begin
  28.     write('y = ', y, ' | ');
  29.  
  30.     // option 1
  31.     //for x := 0 to grid.Items[y].Size-1 do begin
  32.     //  write(x, ' -> ', grid.Items[y].Items[x]:2, ' | ');
  33.     //end;
  34.  
  35.     // option 2
  36.     v := grid.Items[y];
  37.     for x := 0 to v.Size-1 do begin
  38.       write(x, ' -> ', v[x]:2, ' | ');
  39.     end;
  40.  
  41.     writeln;
  42.   end;  
  43.  
  44.   readln;
  45. end.

Code: Pascal  [Select][+][-]
  1. y = 0 | 0 ->  1 | 1 ->  2 | 2 ->  3 |
  2. y = 1 | 0 -> 91 | 1 -> 92 | 2 -> 93 |
« Last Edit: February 07, 2024, 05:25:10 pm by Fibonacci »
FPC Unleashed - inline vars, tuples, statement expressions, array equality, compound assignments, indexed/lazy labels, no-RTTI & more. ⭐ Star it on GitHub!

YiannisKam

  • Full Member
  • ***
  • Posts: 119
Re: How to convert this C++ code into Free Pascal
« Reply #6 on: February 07, 2024, 05:35:20 pm »
Yes, it looks practically disappointing to use :(
Anyway thank you very much for your time Fibonacci  :)
Windows 10 - 64bit
Lazarus version: 3.99
FPC       version: 3.3.1

JdeHaan

  • Full Member
  • ***
  • Posts: 171
Re: How to convert this C++ code into Free Pascal
« Reply #7 on: February 07, 2024, 05:40:08 pm »
Alternatively, you could do:

Code: Pascal  [Select][+][-]
  1. program gridVector;
  2. {$ModeSwitch typehelpers}
  3.  
  4. uses
  5.   gvector;
  6.  
  7. type
  8.   TIntVector = specialize TVector<Integer>;
  9.  
  10.   TIntVectorHelper = type helper for TIntVector
  11.     constructor Create(List: array of Integer);
  12.   end;
  13.  
  14.   TGridVector  = specialize TVector<specialize TVector<Integer>>;
  15.  
  16. var
  17.   Grid: TGridVector;
  18.  
  19. { TVectorHelper }
  20.  
  21. constructor TIntVectorHelper.Create(List: array of Integer);
  22. var
  23.   i: Integer;
  24. begin
  25.   Inherited Create;
  26.   for i := 0 to Length(List) - 1 do
  27.     PushBack(List[i]);
  28. end;
  29.  
  30. begin
  31.   Grid := TGridVector.Create;
  32.   Grid.PushBack(
  33.     TIntVector.Create([0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0]));
  34.  
  35.   // etcetera
  36.  
  37.   ReadLn;
  38. end.
  39.  

Thaddy

  • Hero Member
  • *****
  • Posts: 19139
  • Glad to be alive.
Re: How to convert this C++ code into Free Pascal
« Reply #8 on: February 07, 2024, 05:44:07 pm »
Why declaring as var while it is const. Declare it as const.
objects are fine constructs. You can even initialize them with constructors.

YiannisKam

  • Full Member
  • ***
  • Posts: 119
Re: How to convert this C++ code into Free Pascal
« Reply #9 on: February 07, 2024, 05:56:19 pm »
const? How?
Windows 10 - 64bit
Lazarus version: 3.99
FPC       version: 3.3.1

JdeHaan

  • Full Member
  • ***
  • Posts: 171
Re: How to convert this C++ code into Free Pascal
« Reply #10 on: February 07, 2024, 05:59:00 pm »
or this version:

Code: Pascal  [Select][+][-]
  1. program gridVector;
  2. {$ModeSwitch typehelpers}
  3.  
  4. uses
  5.   gvector;
  6.  
  7. type
  8.   TIntVector = specialize TVector<Integer>;
  9.   TIntArray = array of Integer;
  10.   TIntMatrix = array of TIntArray;
  11.  
  12.   TIntVectorHelper = type helper for TIntVector
  13.     constructor Create(List: TIntArray);
  14.   end;
  15.  
  16.   TGridVector  = specialize TVector<specialize TVector<Integer>>;
  17.  
  18.   TGridVectorHelper = type helper for TGridVector
  19.     constructor Create(Matrix: TIntMatrix);
  20.   end;
  21.  
  22. var
  23.   Grid: TGridVector;
  24.  
  25. { TVectorHelper }
  26.  
  27. constructor TIntVectorHelper.Create(List: TIntArray);
  28. var
  29.   i: Integer;
  30. begin
  31.   Inherited Create;
  32.   for i := 0 to Length(List) - 1 do
  33.     PushBack(List[i]);
  34. end;
  35.  
  36. { TGridVectorHelper }
  37.  
  38. constructor TGridVectorHelper.Create(Matrix: TIntMatrix);
  39. var
  40.   i: Integer;
  41. begin
  42.   Inherited Create;
  43.   for i := 0 to Length(Matrix) - 1 do
  44.     PushBack(TIntVector.Create(Matrix[i]));
  45. end;
  46.  
  47. begin
  48.   Grid := TGridVector.Create(
  49.     [[0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0],
  50.      [0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0],
  51.      [0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0]
  52.      // etcetera
  53.     ]);
  54.  
  55.   ReadLn;
  56. end.
  57.  

Zoran

  • Hero Member
  • *****
  • Posts: 1988
    • http://wiki.lazarus.freepascal.org/User:Zoran
Re: How to convert this C++ code into Free Pascal
« Reply #11 on: February 07, 2024, 07:41:11 pm »
But why do you use helpers? :o

Code: Pascal  [Select][+][-]
  1. program gridVector;
  2.   TGridVector  = specialize TVector<specialize TVector<Integer>>;
  3.  
  4.   TGridVectorHelper = type helper for TGridVector
  5.     constructor Create(Matrix: TIntMatrix);
  6.   end;
  7.  

Using class helpers when you have total control of the original class itself is far from good programming practice.

Code: Pascal  [Select][+][-]
  1. type
  2.   TIntArray = array of Integer;
  3.   TIntMatrix = array of TIntArray;
  4.  
  5.   TIntVector = class(specialize TVector<Integer>)
  6.   public
  7.     constructor Create(List: TIntArray);
  8.   end;
  9.  
  10.   TGridVector  = class(specialize TVector<TIntVector>)
  11.   public
  12.     constructor Create(Matrix: TIntMatrix);
  13.   end;
  14.  
  15. var
  16.   Grid: TGridVector;
  17.  
« Last Edit: February 07, 2024, 07:44:25 pm by Zoran »
Swan, ZX Spectrum emulator https://github.com/zoran-vucenovic/swan

Thaddy

  • Hero Member
  • *****
  • Posts: 19139
  • Glad to be alive.
Re: How to convert this C++ code into Free Pascal
« Reply #12 on: February 07, 2024, 08:16:51 pm »
const? How?
Code: Pascal  [Select][+][-]
  1. const
  2.   grid: array[0..12, 0..22] of integer = (
  3.     (0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0),
  4.     (0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0),
  5.     (0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0),
  6.     (0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0),
  7.     (1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1),
  8.     (1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1),
  9.     (1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1),
  10.     (1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1),
  11.     (1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1),
  12.     (1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1),
  13.     (1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1),
  14.     (1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1),
  15.     (1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1)
  16.   );
objects are fine constructs. You can even initialize them with constructors.

YiannisKam

  • Full Member
  • ***
  • Posts: 119
Re: How to convert this C++ code into Free Pascal
« Reply #13 on: February 07, 2024, 08:38:33 pm »
Yes, I know this, but not what I was looking for. My point was to learn more about vectors in Free Pascal only to find out that it doesn't worth it :( All that fuss just to initialize the Grid :(
Windows 10 - 64bit
Lazarus version: 3.99
FPC       version: 3.3.1

PascalDragon

  • Hero Member
  • *****
  • Posts: 6393
  • Compiler Developer
Re: [SOLVED] How to convert this C++ code into Free Pascal
« Reply #14 on: February 08, 2024, 09:44:07 pm »
With a bit of preparation the following can be achieved:

Code: Pascal  [Select][+][-]
  1. program tvecarr;
  2.  
  3. {$mode objfpc}
  4. {$modeswitch typehelpers}
  5.  
  6. uses
  7.   Generics.Collections;
  8.  
  9. type
  10.   TLongIntList = specialize TList<LongInt>;
  11.   TLongIntListList = specialize TObjectList<TLongIntList>;
  12.  
  13.   TLongIntListHelper = type helper for TLongIntList
  14.     constructor Create(const aArr: array of LongInt);
  15.   end;
  16.  
  17.   TLongIntListListHelper = type helper for TLongIntListList
  18.     constructor Create(const aArr: array of TLongIntList);
  19.   end;
  20.  
  21. constructor TLongIntListHelper.Create(const aArr: array of LongInt);
  22. begin
  23.   inherited Create;
  24.   AddRange(aArr);
  25. end;
  26.  
  27. constructor TLongIntListListHelper.Create(const aArr: array of TLongIntList);
  28. begin
  29.   inherited Create;
  30.   AddRange(aArr);
  31. end;
  32.  
  33. var
  34.   grid: TLongIntListList;
  35. begin
  36.   grid := TLongIntListList.Create([
  37.     TLongIntList.Create([0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0]),
  38.     TLongIntList.Create([0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0]),
  39.     TLongIntList.Create([0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0]),
  40.     TLongIntList.Create([0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0]),
  41.     TLongIntList.Create([1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]),
  42.     TLongIntList.Create([1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]),
  43.     TLongIntList.Create([1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]),
  44.     TLongIntList.Create([1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]),
  45.     TLongIntList.Create([1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]),
  46.     TLongIntList.Create([1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]),
  47.     TLongIntList.Create([1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1]),
  48.     TLongIntList.Create([1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1]),
  49.     TLongIntList.Create([1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1])
  50.   ]);
  51.   grid.Free;
  52. end.

 

TinyPortal © 2005-2018