Skip to main content
deleted 3 characters in body
Source Link
Jörg Hülsermann
  • 13.3k
  • 3
  • 15
  • 36

PHP, 196191 Bytes

for(;a&$k="01112344453"[$i++];print"$l\n")for($l="",$b="+||"[$k%3],$n=0;$n++<$a=$argn;)$l.=$i<6&$n%2&$n!=$a||$i>5&$n%2<1||$i>5&$n==$a=$a|$i>5&($n%2<1|$n==$a)?($l?"":"$b").["----+","    |",sprintf(" %02d |",$n)][$k%3]:"";

Try it online!Try it online!

PHP, 196 Bytes

for(;a&$k="01112344453"[$i++];print"$l\n")for($l="",$b="+||"[$k%3],$n=0;$n++<$a=$argn;)$l.=$i<6&$n%2&$n!=$a||$i>5&$n%2<1||$i>5&$n==$a?($l?"":"$b").["----+","    |",sprintf(" %02d |",$n)][$k%3]:"";

Try it online!

PHP, 191 Bytes

for(;a&$k="01112344453"[$i++];print"$l\n")for($l="",$b="+||"[$k%3],$n=0;$n++<$a=$argn;)$l.=$i<6&$n%2&$n!=$a|$i>5&($n%2<1|$n==$a)?($l?"":"$b").["----+","    |",sprintf(" %02d |",$n)][$k%3]:"";

Try it online!

added 522 characters in body
Source Link
Jörg Hülsermann
  • 13.3k
  • 3
  • 15
  • 36

PHP, 196 Bytes

for(;a&$k="01112344453"[$i++];print"$l\n")for($l="",$b="+||"[$k%3],$n=0;$n++<$a=$argn;)$l.=$i<6&$n%2&$n!=$a||$i>5&$n%2<1||$i>5&$n==$a?($l?"":"$b").["----+","    |",sprintf(" %02d |",$n)][$k%3]:"";

Try it online!

PHP, 235 Bytes

for(;$i++<$a=$argn;)$r[$i==$a|1-$i&1][]=($p=str_pad)($i,2,0,0);for(;$j<6;)$l[]=($a<2&$j<3?"":[$p("+",$c=($j<3?floor:ceil)($a/2)*5+1,"----+"),$p("|",$c,"    |"),"| ".join(" | ",$r[$j/3])." |"])[$j++%3]."\n";echo strtr("01112344453",$l);

Case 1 with optional newlines

Try it online!

Expanded

for(;$i++<$a=$argn;)
  $r[$i==$a|1-$i&1][]=($p=str_pad)($i,2,0,0); # make an 2D array 0:odd values 1:even values and last value  
for(;$j<6;) # create 6 strings for each different line
  $l[]=($a<2&$j<3 # if last value =1 and line number under 3 
    ?"" # make an empty string empty [] as alternative
    :[$p("+",$c=($j<3 # else make the 0 or 3 line and store the count for next line
      ?floor # if line number =0 count=floor ($a/2)  multiply 5 and add 1
      :ceil)($a/2)*5+1,"----+") # else count= ceil($a/2) multiply 5 and add 1
    ,$p("|",$c,"    |") # make lines 1 and 4
    ,"| ".join(" | ",$r[$j/3])." |"])[$j++%3]."\n"; #make lines 2 odd values and 5 even values and last value
echo strtr("01112344453",$l); # Output after replace the digits with the 6 strings

PHP, 300 Bytes

for(;$i++<$a=$argn;)$r[$i==$a||!($i%2)][]=($p=str_pad)($i,2,0,0);echo strtr("01112344453",($a>1?[$p("+",$c=($a/2^0)*5+1,"----+")."\n",$p("|",$c,"    |")."\n","| ".join(" | ",$r[0])." |\n"]:["","",""])+[3=>$p("+",$c=ceil($a/2)*5+1,"----+")."\n",$p("|",$c,"    |")."\n","| ".join(" | ",$r[1])." |\n"]);

replace ["","",""] with ["\n","\n","\n"] if you want newlines for case 1

Try it online!

PHP, 235 Bytes

for(;$i++<$a=$argn;)$r[$i==$a|1-$i&1][]=($p=str_pad)($i,2,0,0);for(;$j<6;)$l[]=($a<2&$j<3?"":[$p("+",$c=($j<3?floor:ceil)($a/2)*5+1,"----+"),$p("|",$c,"    |"),"| ".join(" | ",$r[$j/3])." |"])[$j++%3]."\n";echo strtr("01112344453",$l);

Case 1 with optional newlines

Try it online!

Expanded

for(;$i++<$a=$argn;)
  $r[$i==$a|1-$i&1][]=($p=str_pad)($i,2,0,0); # make an 2D array 0:odd values 1:even values and last value  
for(;$j<6;) # create 6 strings for each different line
  $l[]=($a<2&$j<3 # if last value =1 and line number under 3 
    ?"" # make an empty string empty [] as alternative
    :[$p("+",$c=($j<3 # else make the 0 or 3 line and store the count for next line
      ?floor # if line number =0 count=floor ($a/2)  multiply 5 and add 1
      :ceil)($a/2)*5+1,"----+") # else count= ceil($a/2) multiply 5 and add 1
    ,$p("|",$c,"    |") # make lines 1 and 4
    ,"| ".join(" | ",$r[$j/3])." |"])[$j++%3]."\n"; #make lines 2 odd values and 5 even values and last value
echo strtr("01112344453",$l); # Output after replace the digits with the 6 strings

PHP, 300 Bytes

for(;$i++<$a=$argn;)$r[$i==$a||!($i%2)][]=($p=str_pad)($i,2,0,0);echo strtr("01112344453",($a>1?[$p("+",$c=($a/2^0)*5+1,"----+")."\n",$p("|",$c,"    |")."\n","| ".join(" | ",$r[0])." |\n"]:["","",""])+[3=>$p("+",$c=ceil($a/2)*5+1,"----+")."\n",$p("|",$c,"    |")."\n","| ".join(" | ",$r[1])." |\n"]);

replace ["","",""] with ["\n","\n","\n"] if you want newlines for case 1

Try it online!

PHP, 196 Bytes

for(;a&$k="01112344453"[$i++];print"$l\n")for($l="",$b="+||"[$k%3],$n=0;$n++<$a=$argn;)$l.=$i<6&$n%2&$n!=$a||$i>5&$n%2<1||$i>5&$n==$a?($l?"":"$b").["----+","    |",sprintf(" %02d |",$n)][$k%3]:"";

Try it online!

PHP, 235 Bytes

for(;$i++<$a=$argn;)$r[$i==$a|1-$i&1][]=($p=str_pad)($i,2,0,0);for(;$j<6;)$l[]=($a<2&$j<3?"":[$p("+",$c=($j<3?floor:ceil)($a/2)*5+1,"----+"),$p("|",$c,"    |"),"| ".join(" | ",$r[$j/3])." |"])[$j++%3]."\n";echo strtr("01112344453",$l);

Case 1 with optional newlines

Try it online!

Expanded

for(;$i++<$a=$argn;)
  $r[$i==$a|1-$i&1][]=($p=str_pad)($i,2,0,0); # make an 2D array 0:odd values 1:even values and last value  
for(;$j<6;) # create 6 strings for each different line
  $l[]=($a<2&$j<3 # if last value =1 and line number under 3 
    ?"" # make an empty string empty [] as alternative
    :[$p("+",$c=($j<3 # else make the 0 or 3 line and store the count for next line
      ?floor # if line number =0 count=floor ($a/2)  multiply 5 and add 1
      :ceil)($a/2)*5+1,"----+") # else count= ceil($a/2) multiply 5 and add 1
    ,$p("|",$c,"    |") # make lines 1 and 4
    ,"| ".join(" | ",$r[$j/3])." |"])[$j++%3]."\n"; #make lines 2 odd values and 5 even values and last value
echo strtr("01112344453",$l); # Output after replace the digits with the 6 strings

PHP, 300 Bytes

for(;$i++<$a=$argn;)$r[$i==$a||!($i%2)][]=($p=str_pad)($i,2,0,0);echo strtr("01112344453",($a>1?[$p("+",$c=($a/2^0)*5+1,"----+")."\n",$p("|",$c,"    |")."\n","| ".join(" | ",$r[0])." |\n"]:["","",""])+[3=>$p("+",$c=ceil($a/2)*5+1,"----+")."\n",$p("|",$c,"    |")."\n","| ".join(" | ",$r[1])." |\n"]);

replace ["","",""] with ["\n","\n","\n"] if you want newlines for case 1

Try it online!

Source Link
Jörg Hülsermann
  • 13.3k
  • 3
  • 15
  • 36

PHP, 242235 Bytes

for(;$i++<$a=$argn;)$r[$i==$a||!($i%2)][]=$r[$i==$a|1-$i&1][]=($p=str_pad)($i,2,0,0);for(;$j<6;$j++;$j<6;)$l[]=($a<2&$j<3?[]"":[$p("+",$c=($j<3?$a/2^0floor:ceil)($a/2))*5+1,"----+"),$p("|",$c,"    |"),"| ".join(" | ",$r[$j/3^0]3])." |"])[$j%3][$j++%3]."\n";echo strtr("01112344453",$l);

Case 1 with optional newlines

Try it online!Try it online!

Expanded

for(;$i++<$a=$argn;)
  $r[$i==$a|1-$i&1][]=($p=str_pad)($i,2,0,0); # make an 2D array 0:odd values 1:even values and last value  
for(;$j<6;) # create 6 strings for each different line
  $l[]=($a<2&$j<3 # if last value =1 and line number under 3 
    ?"" # make an empty string empty [] as alternative
    :[$p("+",$c=($j<3 # else make the 0 or 3 line and store the count for next line
      ?floor # if line number =0 count=floor ($a/2)  multiply 5 and add 1
      :ceil)($a/2)*5+1,"----+") # else count= ceil($a/2) multiply 5 and add 1
    ,$p("|",$c,"    |") # make lines 1 and 4
    ,"| ".join(" | ",$r[$j/3])." |"])[$j++%3]."\n"; #make lines 2 odd values and 5 even values and last value
echo strtr("01112344453",$l); # Output after replace the digits with the 6 strings

PHP, 300 Bytes

for(;$i++<$a=$argn;)$r[$i==$a||!($i%2)][]=($p=str_pad)($i,2,0,0);echo strtr("01112344453",($a>1?[$p("+",$c=($a/2^0)*5+1,"----+")."\n",$p("|",$c,"    |")."\n","| ".join(" | ",$r[0])." |\n"]:["","",""])+[3=>$p("+",$c=ceil($a/2)*5+1,"----+")."\n",$p("|",$c,"    |")."\n","| ".join(" | ",$r[1])." |\n"]);

replace ["","",""] with ["\n","\n","\n"] if you want newlines for case 1

Try it online!

PHP, 242 Bytes

for(;$i++<$a=$argn;)$r[$i==$a||!($i%2)][]=($p=str_pad)($i,2,0,0);for(;$j<6;$j++)$l[]=($a<2&$j<3?[]:[$p("+",$c=($j<3?$a/2^0:ceil($a/2))*5+1,"----+"),$p("|",$c,"    |"),"| ".join(" | ",$r[$j/3^0])." |"])[$j%3]."\n";echo strtr("01112344453",$l);

Case 1 with optional newlines

Try it online!

PHP, 300 Bytes

for(;$i++<$a=$argn;)$r[$i==$a||!($i%2)][]=($p=str_pad)($i,2,0,0);echo strtr("01112344453",($a>1?[$p("+",$c=($a/2^0)*5+1,"----+")."\n",$p("|",$c,"    |")."\n","| ".join(" | ",$r[0])." |\n"]:["","",""])+[3=>$p("+",$c=ceil($a/2)*5+1,"----+")."\n",$p("|",$c,"    |")."\n","| ".join(" | ",$r[1])." |\n"]);

replace ["","",""] with ["\n","\n","\n"] if you want newlines for case 1

Try it online!

PHP, 235 Bytes

for(;$i++<$a=$argn;)$r[$i==$a|1-$i&1][]=($p=str_pad)($i,2,0,0);for(;$j<6;)$l[]=($a<2&$j<3?"":[$p("+",$c=($j<3?floor:ceil)($a/2)*5+1,"----+"),$p("|",$c,"    |"),"| ".join(" | ",$r[$j/3])." |"])[$j++%3]."\n";echo strtr("01112344453",$l);

Case 1 with optional newlines

Try it online!

Expanded

for(;$i++<$a=$argn;)
  $r[$i==$a|1-$i&1][]=($p=str_pad)($i,2,0,0); # make an 2D array 0:odd values 1:even values and last value  
for(;$j<6;) # create 6 strings for each different line
  $l[]=($a<2&$j<3 # if last value =1 and line number under 3 
    ?"" # make an empty string empty [] as alternative
    :[$p("+",$c=($j<3 # else make the 0 or 3 line and store the count for next line
      ?floor # if line number =0 count=floor ($a/2)  multiply 5 and add 1
      :ceil)($a/2)*5+1,"----+") # else count= ceil($a/2) multiply 5 and add 1
    ,$p("|",$c,"    |") # make lines 1 and 4
    ,"| ".join(" | ",$r[$j/3])." |"])[$j++%3]."\n"; #make lines 2 odd values and 5 even values and last value
echo strtr("01112344453",$l); # Output after replace the digits with the 6 strings

PHP, 300 Bytes

for(;$i++<$a=$argn;)$r[$i==$a||!($i%2)][]=($p=str_pad)($i,2,0,0);echo strtr("01112344453",($a>1?[$p("+",$c=($a/2^0)*5+1,"----+")."\n",$p("|",$c,"    |")."\n","| ".join(" | ",$r[0])." |\n"]:["","",""])+[3=>$p("+",$c=ceil($a/2)*5+1,"----+")."\n",$p("|",$c,"    |")."\n","| ".join(" | ",$r[1])." |\n"]);

replace ["","",""] with ["\n","\n","\n"] if you want newlines for case 1

Try it online!

added 651 characters in body
Source Link
Jörg Hülsermann
  • 13.3k
  • 3
  • 15
  • 36
Loading
deleted 10 characters in body
Source Link
Jörg Hülsermann
  • 13.3k
  • 3
  • 15
  • 36
Loading
added 73 characters in body
Source Link
Jörg Hülsermann
  • 13.3k
  • 3
  • 15
  • 36
Loading
Source Link
Jörg Hülsermann
  • 13.3k
  • 3
  • 15
  • 36
Loading