* * *

Author Topic: PASCAL felzz Cool (it is so self explaining)  (Read 2354 times)

jc99

  • Hero Member
  • *****
  • Posts: 516
    • My private Site
PASCAL felzz Cool (it is so self explaining)
« on: June 16, 2017, 05:16:25 pm »
Like this:
Code: Pascal  [Select]
  1. Program Iopcc;{$apptype console}{$define _}Type L=Integer;I=0..3;Const Z=1 Shl 11;U=$13 Shl 1+1;O=U And-U;D=O Shl(O Shl O+O);C=' _|';B=$597B;
  2. l0:Array[I]Of L=(0,-3,U-O,-O);lQ:Array[I]Of L=(O,U,-O,-U);Var E:Array[0..Z]Of L;Function H(Var Q:L):L;Begin H:=Q;Inc(Q);End;Procedure Q(U:L);Begin
  3. If U<D Then Write(C[B Shr(H(U)Shl 1) And 3]+C[B Shr(U Shl 1)And 3])Else Write(Copy(C+C+C+LineEnding,U+O,3));End;Var
  4.  
  5.       Hel:l=0;Wor:l=d-D;  P,A,S,CA:L;_fe:l=z-z;_C,oo:l;
  6.  
  7. ll:Array[0..Z]Of L;l1:Array[I]Of L;Begin Randomize;E[0]:=8;CA:=U*U-O;A:=CA;E[CA]:=Z+2;While(Wor<>0)Or(_fe>=Hel)Do Begin S:=CA;CA:=A;_C:=E[S];Wor:=0;
  8. For P In l0 Do Begin A:=lQ[P And 3]+S;If((A>=0)And(A<U*U)And(P<>(A Mod U))And((_C And Z)<>(E[A]And Z)))Then Begin l1[H(Wor)]:=P;End;End;If (Wor<>0)Then
  9. Begin P:=l1[Random(Wor)]And 3;A:=lQ[P]+S;E[S]:=_C Or O Shl P;E[A]:=E [A]Or Z Or(O Shl((P+2)Mod 4));ll[H(_fe)]:=A;End Else Begin If _fe>=Hel Then
  10. A:=ll [H(Hel)];End;End;Q(6);For S:=O To U-O Do Q(4);Q(D+O);For S:=O To U Do Begin For A :=O To U Do Q(E[H(Oo)]And 6);Q(D);End;{$IFDEF _}Readln;{$ENDIF}End.
« Last Edit: June 21, 2017, 08:09:29 am by jc99 »
OS: Win XP x64, Win 7, Win 7 x64, Win 10, Win 10 x64, Suse Linux 13.2
Laz: 1.2 - 1.6.4, 1.8rc3
https://github.com/joecare99/public
'~|    /''
,_|oe \_,are

Thaddy

  • Hero Member
  • *****
  • Posts: 4633
Re: PASCAL felzz Cool (it is so self explaining)
« Reply #1 on: June 16, 2017, 09:37:36 pm »
fIopcc.pas(1,16) Warning: APPTYPE is not supported by the target OS
Iopcc.pas(10,4) Warning: Variable "ll" does not seem to be initialized
Iopcc.pas(9,10) Warning: Variable "l1" does not seem to be initialized

Now compile with -Sew (Which I do as standard, so at first it didn't work)

But it is cool  8-)
« Last Edit: June 16, 2017, 09:39:30 pm by Thaddy »
"Logically, no number of positive outcomes at the level of experimental testing can confirm a scientific theory, but a single counterexample is logically decisive."

qq9ebg9acvzx

  • New member
  • *
  • Posts: 9
Re: PASCAL felzz Cool (it is so self explaining)
« Reply #2 on: June 16, 2017, 09:49:10 pm »
Here is the fixed version of the code:
Code: Pascal  [Select]
  1. program Iopcc;
  2.  
  3. {$apptype console}
  4. {$define _}
  5.  
  6. type
  7.   L = integer;
  8.   I = 0..3;
  9.  
  10. const
  11.   Z = 1 shl 11;
  12.   U = $13 shl 1 + 1;
  13.   O = U and -U;
  14.   D = O shl (O shl O + O);
  15.   C = ' _|';
  16.   B = $597B;
  17.   l0: array[I] of L = (0, -3, U - O, -O);
  18.   lQ: array[I] of L = (O, U, -O, -U);
  19.  
  20. var
  21.   E: array[0..Z] of L;
  22.  
  23. function H(var Q: L): L;
  24. begin
  25.   H := Q;
  26.  
  27.   Inc(Q);
  28. end;
  29.  
  30. procedure Q(U: L);
  31. begin
  32.   if U < D then
  33.     Write(C[B shr (H(U) shl 1) and 3] + C[B shr (U shl 1) and 3])
  34.   else
  35.     Write(Copy(C + C + C + LineEnding, U + O, 3));
  36. end;
  37.  
  38. var
  39.   Hel        : l = 0;
  40.   Wor        : l = d - D;
  41.   P, A, S, CA: L;
  42.   _fe        : l = z - z;
  43.   _C, oo     : l;
  44.   ll         : array[0..Z] of L;
  45.   l1         : array[I] of L;
  46.  
  47. begin
  48.   Randomize;
  49.  
  50.   E[0] := 8;
  51.  
  52.   CA := U * U - O;
  53.  
  54.   A := CA;
  55.  
  56.   E[CA] := Z + 2;
  57.  
  58.  
  59.   while (Wor <> 0) or (_fe >= Hel) do
  60.   begin
  61.     S   := CA;
  62.     CA  := A;
  63.     _C  := E[S];
  64.     Wor := 0;
  65.  
  66.     for P in l0 do
  67.     begin
  68.       A := lQ[P and 3] + S;
  69.  
  70.       if ((A >= 0) and (A < U * U) and (P <> (A mod U)) and ((_C and Z) <> (E[A] and Z))) then
  71.       begin
  72.         l1[H(Wor)] := P;
  73.       end;
  74.     end;
  75.  
  76.  
  77.     if (Wor <> 0) then
  78.     begin
  79.       P := l1[Random(Wor)] and 3;
  80.  
  81.       A := lQ[P] + S;
  82.  
  83.       E[S] := _C or O shl P;
  84.  
  85.       E[A] := E[A] or Z or (O shl ((P + 2) mod 4));
  86.  
  87.       ll[H(_fe)] := A;
  88.     end
  89.       else
  90.     begin
  91.       if _fe >= Hel then
  92.         A := ll[H(Hel)];
  93.     end;
  94.   end;
  95.  
  96.   Q(6);
  97.  
  98.   for S := O to U - O do
  99.     Q(4);
  100.  
  101.   Q(D + O);
  102.  
  103.   for S := O to U do
  104.   begin
  105.     for A := O to U do
  106.       Q(E[H(Oo)] and 6);
  107.  
  108.     Q(D);
  109.   end;
  110.  
  111. {$IFDEF _}
  112.   Readln;
  113. {$ENDIF}
  114. end.
  115.  

It compiled.

jc99

  • Hero Member
  • *****
  • Posts: 516
    • My private Site
Re: PASCAL felzz Cool (it is so self explaining)
« Reply #3 on: June 16, 2017, 10:59:50 pm »
For those whining about a commented and beautified version : ;)
Here it is [edit: final version]:
Code: Pascal  [Select]
  1. Unit Unt_iopcc;    {$mode         delphi}{$H+}        Interface      Procedure     Main;
  2. Implementation   {$define _}    type L=integer      ;I=0..3;const   Z=1 shl 11;    U=$13
  3. shl        1+1;  O=U     and    -U;D               =O shl          (O shl    O +   O);C=
  4. ' _|'      ;B=  $597B     ;l0:  array              [I]of           L=(0,     -3,U  -O,-O)
  5.  
  6. ;lQ:array[I]    of L= (O,U,-O,  -U);var E:array    [0..Z]          of L; function  H(var
  7. Q:L):L;begin    H:= Q; Inc (Q)    ;end;procedure   Q(U:L);         begin if U < D  then
  8.  
  9. Write           (C[B       shr              (H(U)  shl 1)          and       3]+C  [B shr
  10. ( U             shl         1)              and 3   ])else         Write     (Copy  (C+C+C+LineEnding,
  11. U+O,            3));      end;   {!} Procedure       Main;  {!!!}  var        ll:  array[0.. Z] of L;
  12. // #            This        is     Just an Dum-       my Comment   to ~      fill  the Gaps ********
  13.  
  14.  
  15.                                          Hel:l=0; //LGPL 2017
  16.                                          Wor:l=d-D; // by Joe
  17.  
  18.                                           P,A,S,CA:L; //Care
  19.                                           _fe:l=z-z;_C,oo:l;
  20.  
  21.  
  22.  
  23.            l1:array            [I]of L;begin              Randomize;            E[0]:=
  24.         d;CA:=U*U-O;A         :=CA;E[CA]:=Z+2;           while(Wor<>0)          or(_fe
  25.         >=Hel)      do       begin       oO:=0         ;S:=CA      ;CA:=        A;_C:=
  26.         E[S];                Wor:=0      ;for P        in(l0       )  do        begin
  27.         A:=lQ                [P and      3]+S;         if((A       >= 0)        and(A<
  28.         U*U)                 and(P<>     (A mod        U))and      (( _C        and Z)
  29.         <>(E                 [A]and       Z)))         then        begin        l1[ H(
  30.         Wor)                 ]:=P;        end;         end ;       if  (        Wor<>0
  31.         )then                begin        P:=l1[       Random     (Wor)]        and 3;
  32.         A:=lQ                [P]+S        ;E[S]        := _C       or  O        shl P;
  33.         E[A]                 :=E[A]or     Z or(        O shl(      (P+2)        mod 4));ll[H(_fe)]
  34.         :=A;end               else         begin        if _fe     >=Hel        then A:=ll[H(Hel)];
  35.         end;end      ;        Q(d-2);     for S        :=O to     U-O do        Q(D shr O);Q(D+O);
  36.          for S:=O to U          do  begin  for            A:=O to U do          Q(E[H(Oo)]and 6
  37.           );Q(D);end;             {$IFDEF _}                Readln ;            {$ENDIF}End;end.
  38.                                                                            
  39. //         (C)ode an                (O)pen             (O)bjectoriented         (L)anguage !!!!!

Ps: The real Commented version and Main program are attached <!Spoiler!>
or in my repository ...
« Last Edit: June 21, 2017, 08:11:29 am by jc99 »
OS: Win XP x64, Win 7, Win 7 x64, Win 10, Win 10 x64, Suse Linux 13.2
Laz: 1.2 - 1.6.4, 1.8rc3
https://github.com/joecare99/public
'~|    /''
,_|oe \_,are

Leledumbo

  • Hero Member
  • *****
  • Posts: 7719
  • Programming + Glam Metal + Tae Kwon Do = Me
Re: PASCAL felzz Cool (it is so self explaining)
« Reply #4 on: June 16, 2017, 11:24:50 pm »
So now IOPCC exists?

jc99

  • Hero Member
  • *****
  • Posts: 516
    • My private Site
Re: PASCAL felzz Cool (it is so self explaining)
« Reply #5 on: June 17, 2017, 12:31:08 am »
@Leledumbo: Not Officially, But If you have something to contribute, fell free,
At the end of the Year we can make a Poll to vote the Winner ...
[Edit]
(I)nofficial
 (O)bfuscated
  (P)ascal 
   (C)oding
    (C)ontest
     2017
« Last Edit: June 18, 2017, 01:01:30 am by jc99 »
OS: Win XP x64, Win 7, Win 7 x64, Win 10, Win 10 x64, Suse Linux 13.2
Laz: 1.2 - 1.6.4, 1.8rc3
https://github.com/joecare99/public
'~|    /''
,_|oe \_,are

RAW

  • Hero Member
  • *****
  • Posts: 562
Re: PASCAL felzz Cool (it is so self explaining)
« Reply #6 on: June 17, 2017, 03:16:24 am »
Quote
For those whining about a commented and beautified version : ;)
I like the P A S C A L  version...  :D
Windows 7 Pro (x64 Sp1) And Windows XP Pro (x86 Sp3) - LAZARUS 1.8.0RC5 FPC 3.0.4

Thaddy

  • Hero Member
  • *****
  • Posts: 4633
Re: PASCAL felzz Cool (it is so self explaining)
« Reply #7 on: June 17, 2017, 10:26:06 am »
Plz add a solver. 8-)
"Logically, no number of positive outcomes at the level of experimental testing can confirm a scientific theory, but a single counterexample is logically decisive."

avra

  • Hero Member
  • *****
  • Posts: 1146
    • Additional info
Re: PASCAL felzz Cool (it is so self explaining)
« Reply #8 on: June 17, 2017, 03:30:51 pm »
For those whining about a commented and beautified version : ;)
+1   This has really made my day!    8) 8-) 8)
ct2laz - Easily convert components and projects between Lazarus and CodeTyphon

Thaddy

  • Hero Member
  • *****
  • Posts: 4633
Re: PASCAL felzz Cool (it is so self explaining)
« Reply #9 on: June 17, 2017, 04:15:37 pm »
Can I print it on a T-shirt? plz,plz? (the beautified version?
"Logically, no number of positive outcomes at the level of experimental testing can confirm a scientific theory, but a single counterexample is logically decisive."

jc99

  • Hero Member
  • *****
  • Posts: 516
    • My private Site
Re: PASCAL felzz Cool (it is so self explaining)
« Reply #10 on: June 18, 2017, 12:58:05 am »
Programm is published under LGPL.
Also my Idea. So it's OK, feel free to add a small comment comment: "LGPL, by Joe care". In my company is a small studio they can stitch it on a T-Shirt, I thought of a black T-Shirt and the Text Syntax-Colored on the Back.
Maybe the "creation" on the front.
OS: Win XP x64, Win 7, Win 7 x64, Win 10, Win 10 x64, Suse Linux 13.2
Laz: 1.2 - 1.6.4, 1.8rc3
https://github.com/joecare99/public
'~|    /''
,_|oe \_,are

jc99

  • Hero Member
  • *****
  • Posts: 516
    • My private Site
Re: PASCAL felzz Cool (it is so self explaining)
« Reply #11 on: June 18, 2017, 02:15:04 am »
Plz add a solver. 8-)
Should be no problem, all the information is there ...
Maybe in on the next Posts ...
Or I'll make a 3D-Walktrough
 
OS: Win XP x64, Win 7, Win 7 x64, Win 10, Win 10 x64, Suse Linux 13.2
Laz: 1.2 - 1.6.4, 1.8rc3
https://github.com/joecare99/public
'~|    /''
,_|oe \_,are

jc99

  • Hero Member
  • *****
  • Posts: 516
    • My private Site
Re: PASCAL felzz Cool (it is so self explaining)
« Reply #12 on: June 19, 2017, 12:59:15 am »
Can I print it on a T-shirt? plz,plz? (the beautified version?
Use this Version:
Code: Pascal  [Select]
  1. Unit Unt_iopcc;    {$mode         delphi}{$H+}        Interface       Procedure    Main;
  2. Implementation   {$define _}    type L=integer      ;I=0..3;const    Z=1 shl 11;   U=$13
  3. shl        1+1;  O=U     and    -U;D               =O shl           (O shl    O+   O);C=
  4. ' _|'      ;B=  $597B     ;l0:  array             [I]of           L=(0,     -3,U  -O,-O)
  5.  
  6. ;lQ:array[I]    of L= (O,U,-O,  -U);var E:array    [0..Z]          of L; function  H(var
  7. Q:L):L;begin    H:= Q; Inc (Q)    ;end;procedure   Q(U:L);         begin if U < D  then
  8.  
  9. Write           (C[B       shr              (H(U)  shl 1)          and       3]+C  [B shr
  10. ( U             shl         1)              and 3   ])else          Write    (Copy  (C+C+C+LineEnding,
  11. U+O,            3));      end;   {!} Procedure       Main;  {!!!}  var        ll:  array[0.. Z] of L;
  12. // #            This        is     Just an Dum-       my Comment   to ~      fill  the Gaps ********
  13.  
  14.  
  15.                                          Hel:l=0; //LGPL 2017
  16.                                          Wor:l=d-D; // by Joe
  17.  
  18.                                           P,A,S,CA:L; //Care
  19.                                           _fe:l=z-z;_C,oo:l;
  20.  
  21.  
  22.  
  23.            l1:array            [I]of L;begin              Randomize;            E[0]:=
  24.         d;CA:=U*U-O;A         :=CA;E[CA]:=Z+2;           while(Wor<>0)          or(_fe
  25.         >=Hel)      do       begin       oO:=0         ;S:=CA      ;CA:=        A;_C:=
  26.         E[S];                Wor:=0      ;for P        in l0       do           begin
  27.         A:=lQ                [P and      3]+S;         if((A       >=0)         and(A<
  28.         U*U)                 and(P<>     (A mod        U))and      ((_C         and Z)
  29.         <>(E                 [A]and       Z)))         then        begin        l1[ H(
  30.         Wor)                 ]:=P;        end;         end ;        if(         Wor<>0
  31.         )then                begin        P:=l1[       Random     (Wor)]        and 3;
  32.         A:=lQ                [P]+S        ;E[S]        :=_C        or O         shl P;
  33.         E[A]                 :=E[A]or     Z or(        O shl(      (P+2)        mod 4));ll[H(_fe)]
  34.         :=A;end               else         begin        if _fe     >=Hel        then A:=ll[H(Hel)];
  35.         end;end      ;        Q(d-2);     for S        :=O to     U-O do        Q(D shr O);Q(D+O);
  36.          for S:=O to U          do  begin  for            A:=O to U do          Q(E[H(Oo)]and 6
  37.           );Q(D);end;             {$IFDEF _}               Readln;              {$ENDIF}End;end.
  38.                                                                            
  39. //         (C)ode an                (O)pen             (O)bjectoriented         (L)anguage !!!!!
OS: Win XP x64, Win 7, Win 7 x64, Win 10, Win 10 x64, Suse Linux 13.2
Laz: 1.2 - 1.6.4, 1.8rc3
https://github.com/joecare99/public
'~|    /''
,_|oe \_,are

jc99

  • Hero Member
  • *****
  • Posts: 516
    • My private Site
Re: PASCAL felzz Cool (it is so self explaining)
« Reply #13 on: June 19, 2017, 09:32:37 pm »
Next Entry for the IOPCC-Contest:
Code: Pascal  [Select]
  1. unit unt_iopcc17_2;interface procedure Main;implementation uses Math;type l0=0..
  2. 11;e=integer;const ll=$EA48A42E8EA435F;l1:e=-$CD;lO=$40840708F7D8E14D;lI=ll and-ll
  3. ;lQ=lI-lI;l=lI shl lI;I=l shl l;Q=I-l-lI;D=#8' \_/';procedure Main;var Jo:e=2017;
  4. Ca,r:e;begin l1+=Jo;for Ca in l0 do begin Write(StringOfChar(D[l],(I+Q)-Ca));for
  5. Jo:=lQ to(I+I)do for r in l0 do if r<Q+(Jo mod(I-Q))and l then Write(D[((ll xor lO
  6. )div round(power(Q,((I+lI)*(I-Q))-(((ll xor l1)shr(((((ll shr((Jo and(I+I-lI))*(Q
  7. -lI)+Ca div(I-Q)))and((I-Q)-(Ca div(I+lI))shl lI))-(Q-lI)+(l-Ca mod(I-Q))shl l)mod
  8. (Q-lI)+(I-Q))*l)and(l+lI))*(I-lI)+r)))mod Q)+lI]);writeln;end;readln;end;end.
OS: Win XP x64, Win 7, Win 7 x64, Win 10, Win 10 x64, Suse Linux 13.2
Laz: 1.2 - 1.6.4, 1.8rc3
https://github.com/joecare99/public
'~|    /''
,_|oe \_,are

jc99

  • Hero Member
  • *****
  • Posts: 516
    • My private Site
Re: PASCAL felzz Cool (it is so self explaining)
« Reply #14 on: June 21, 2017, 06:25:01 pm »
Here is the beautified and commented version ;)
Code: Pascal  [Select]
  1.        UNIT
  2.        { ©by
  3.       Joe }
  4.  
  5.      {Care}             uIopcc172;      interface{$H+}      uses Math;     type     l0=  0..11       ;e={}     integer;
  6.      {2017}          function M: e;     implementation   const {This ##    CONST   ARE   HERE#       #}l3=   LineEnding;
  7.      lO={#}        $40840708F7D8E14D   ;l1:e=-$CD; ll=  $EA48A42E8EA435f  {This   are   other       CONST}  ;lI=ll and-ll;
  8.     lQ=lI-          lI;     l=lI shl   lI;I=l shl l;Q    =I-     l-lI;{}  Function M:   e;var       Jo:e=   2017;     Ca,
  9.  
  10.     r:e{}               ;CONST D=#8+        ' \_/';        begin l1+=    Jo;for        Ca in       l0 do    begin Write
  11.     {->}(            StringOfChar(D[       l],(I+Q       )-Ca));for Jo   := lQ         to(I+       I) do     for r in l0
  12.     do if          r<Q+(Jo mod(I-Q))      and l-0      then Write(D[((   ll xor       lO)div      round      (power(Q,((I
  13.    +lI)*(         I-Q))-   ( ( ( ll      xor l1)      shr(((   ( ( ll   shr((         Jo and      (I+I-        lI))*(Q-lI
  14.  
  15.  )+Ca div(I-Q))) and((       I-Q)-   (Ca div (I+lI   )) shl     lI))   -( Q-         lI)+(l-Ca mod(I-Q))  shl     l)mod
  16.  (Q-lI)+(I-Q))*l )and(l+lI))*(I-lI   )+r)))mod Q)+   lI]);write(l3)    ;end;         readln;//IS#ONE###   #OF#THE#BEST#
  17.  {INTRÈGRATED#-#  DEVELOPMENT AND#   OBJECTPASCAL#   LEARNING #ENV-    IRON-          MENTS# OUT# HERE#    TO#SAY#THE#
  18. #LEAST!!!######   #########  ####   ###}M:=l;{###     ######  ####    #####            SO#THIS# IS#THE      }end;end.
« Last Edit: June 21, 2017, 06:27:04 pm by jc99 »
OS: Win XP x64, Win 7, Win 7 x64, Win 10, Win 10 x64, Suse Linux 13.2
Laz: 1.2 - 1.6.4, 1.8rc3
https://github.com/joecare99/public
'~|    /''
,_|oe \_,are

 

Recent

Get Lazarus at SourceForge.net. Fast, secure and Free Open Source software downloads Open Hub project report for Lazarus