Skip to main content
added 2046 characters in body
Source Link
Dennis
  • 211.7k
  • 41
  • 380
  • 830

CJam, 70 6262 59 bytes

Qali{_'L:Xf+\'S:Yf++}*{[_\{X2*_X2*/Xf-Yf/Xf*Y*_Xf*Y*}h]N*_X3*#\Y2*#=},p 

The idea is to push all strings of L's ansand S's of the proper length, successively apply the transformation to each until the result is an empty string, concatenate the sequences of strings and search for the forbidden substrings.

(to be continued)

Qa " Push R := [ '' ]. "; li{ " Do the following int(input()) times: "; _'L:Xf+ " Append (X := 'L') to a copy of all strings in R. "; \'S:Yf+ " Append (Y := 'S') to all original strings in R. "; + " Concatenate the arrays into R. "; }* " R now contains all strings of L's and S's of length int(input()). "; { " For each S ∊ R: "; { " "; _ " Push a copy of S. "; X2*/ " Split S at 'LL'. "; Xf- " Remove 'L' from the chunks. "; Yf/ " Split the chunks at 'S'. "; Xf* " Join the chunks, separating by 'L'. "; Y* " Join, separating by 'S'. "; }h " If the resulting string is non-empty, repeat. "; ]N* " Join the array of resulting strings from S to '', separating by linefeeds. "; _X3*# " Push the index of 'LLL' a copy in the resulting string (-1 if not present). "; \Y2*# " Push the index of 'SS' in the original string (-1 if not present). "; = " Check if the indexes are equal; this happens if and only if both are -1. "; }, " Filter: Keep S in R if and only if = pushed 1. "; p " Print a string representation of R. "; 

CJam, 70 62 bytes

Qali{_'L:Xf+\'S:Yf++}*{[_\{X2*/Xf-Yf/Xf*Y*_}h]N*_X3*#\Y2*#=},p 

The idea is to push all strings of L's ans S's of the proper length, successively apply the transformation to each until the result is an empty string, concatenate the sequences of strings and search for the forbidden substrings.

(to be continued)

CJam, 70 62 59 bytes

Qali{_'L:Xf+\'S:Yf++}*{{_X2*/Xf-Yf/Xf*Y*}h]N*_X3*#\Y2*#=},p 

The idea is to push all strings of L's and S's of the proper length, successively apply the transformation to each until the result is an empty string, concatenate the sequences of strings and search for the forbidden substrings.

Qa " Push R := [ '' ]. "; li{ " Do the following int(input()) times: "; _'L:Xf+ " Append (X := 'L') to a copy of all strings in R. "; \'S:Yf+ " Append (Y := 'S') to all original strings in R. "; + " Concatenate the arrays into R. "; }* " R now contains all strings of L's and S's of length int(input()). "; { " For each S ∊ R: "; { " "; _ " Push a copy of S. "; X2*/ " Split S at 'LL'. "; Xf- " Remove 'L' from the chunks. "; Yf/ " Split the chunks at 'S'. "; Xf* " Join the chunks, separating by 'L'. "; Y* " Join, separating by 'S'. "; }h " If the resulting string is non-empty, repeat. "; ]N* " Join the array of resulting strings from S to '', separating by linefeeds. "; _X3*# " Push the index of 'LLL' a copy in the resulting string (-1 if not present). "; \Y2*# " Push the index of 'SS' in the original string (-1 if not present). "; = " Check if the indexes are equal; this happens if and only if both are -1. "; }, " Filter: Keep S in R if and only if = pushed 1. "; p " Print a string representation of R. "; 
added 383 characters in body
Source Link
Dennis
  • 211.7k
  • 41
  • 380
  • 830

CJam, 7070 62 bytes

LaliQali{_'Lf+\'Sf++_'L:Xf+\'S:Yf++}*{[_\{"LL"X2*/N*'LXf-'S/'L*NYf/'S*_Xf*Y*_}h]N*_"LLL"/\"SS"/+,2=h]N*_X3*#\Y2*#=},p 

Reads from STDIN. Try it online.

Example run

$ cjam tilings.cjam <<< 5 ["LLSLL" "SLSLL" "SLLSL" "LSLSL" "LSLLS" "LLSLS"] 

How it works

The idea is to push all strings of L's ans S's of the proper length, successively apply the transformation to each until the result is an empty string, concatenate the sequences of strings and search for the forbidden substrings.

(to be continued)

CJam, 70 bytes

Lali{_'Lf+\'Sf++}*{[_\{"LL"/N*'L-'S/'L*N/'S*_}h]N*_"LLL"/\"SS"/+,2=},p 

Reads from STDIN. Try it online.

CJam, 70 62 bytes

Qali{_'L:Xf+\'S:Yf++}*{[_\{X2*/Xf-Yf/Xf*Y*_}h]N*_X3*#\Y2*#=},p 

Reads from STDIN. Try it online.

Example run

$ cjam tilings.cjam <<< 5 ["LLSLL" "SLSLL" "SLLSL" "LSLSL" "LSLLS" "LLSLS"] 

How it works

The idea is to push all strings of L's ans S's of the proper length, successively apply the transformation to each until the result is an empty string, concatenate the sequences of strings and search for the forbidden substrings.

(to be continued)

added 4 characters in body
Source Link
Dennis
  • 211.7k
  • 41
  • 380
  • 830

CJam, 6670 bytes

Lali{_'L:Lf+\'S:Sf++_'Lf+\'Sf++}*{[_\{L2*"LL"/N*LN*'L-S'S/L*N'L*N/S*_'S*_}h]N*_L3*h]N*_"LLL"/\S2*\"SS"/+,2=},p 

Reads from STDIN. Try it online.

CJam, 66 bytes

Lali{_'L:Lf+\'S:Sf++}*{[_\{L2*/N*L-S/L*N/S*_}h]N*_L3*/\S2*/+,2=},p 

Reads from STDIN. Try it online.

CJam, 70 bytes

Lali{_'Lf+\'Sf++}*{[_\{"LL"/N*'L-'S/'L*N/'S*_}h]N*_"LLL"/\"SS"/+,2=},p 

Reads from STDIN. Try it online.

Source Link
Dennis
  • 211.7k
  • 41
  • 380
  • 830
Loading