Jump to content

Sierpinski carpet: Difference between revisions

Add Brainf*** implementation.
m (J: remove failing golfed code, and clean up presentation slightly)
(Add Brainf*** implementation.)
Line 1,050:
 
[https://mlochbaum.github.io/BQN/try.html#code=X2RlY29kZSDihpAge+KMvfCdlZd84oyK4oiYw7fin5zwnZWX4o2fKOKGlTErwrfijIrwnZWX4ouG4oG8MeKMiOKKoil9CkNhcnBldCDihpAgeyAgIyAyRCBBcnJheSBtZXRob2QgdXNpbmcg4oi+LgogIHviiL4oM+KAvzPipYo04omg4oaVOSniio/in6go4omi8J2VqSnipYowLPCdlanin6l94o2fKPCdlaktMSkgMeKAvzHipYoxCn0KQ2FycGV0MSDihpAgeyAjIGJhc2UgY29udmVyc2lvbiBtZXRob2QsIHdvcmtzIGluIGEgc2luZ2xlIHN0ZXAuCiAgwqx74oiowrTwnZWo4oin4peLKCgt8J2VqOKMiOKXi+KJoPCdlakp4oq44oaRKfCdlal94oycy5wyfDMgX2RlY29kZcKo4oaVM+KLhvCdlaktMQp9CgrigKJTaG93ICIgIyLiio/LnENhcnBldCA0CuKAolNob3cgKENhcnBldCDiiaEgQ2FycGV0MSkgNAoK Try It!]
 
 
=={{header|Brainf***}}==
Double the first two prints for squarer output.
<lang brainf***>input order and print the associated Sierpinski carpet
orders over 5 require larger cell sizes
 
+++>>+[[-]>[-],[+[-----------[>[-]++++++[<------>-]<--<<[->>++++++++++<<]>>[-<<+
>>]<+>]]]<]<<[>>+<<-]+>[>>[-]>[-]<<<<[>>>>+<<<<-]>>>>[<<[<<+>>>+<-]>[<+>-]>-]<<<
-]>[-]<<[>+>+<<-]>>[<<+>>-]<[<[>>+>+<<<-]>>>[<<<+>>>-]<[<[>>+>>>+<<<<<-]>>[<<+>>
-]<[>>+>>>+<<<<<-]>>[<<+>>-]>>->-<<<<+[[>+>+<<-]>[<+>-]>[>[>>+>+<<<-]>>>[<<<+>>>
-]+++<[->-[>+>>]>[+[-<+>]>+>>]<<<<<]>[-]>>[-]<->+<[>-]>[<<<+>>>->]<<[-]<<<[>>+>+
<<<-]>>>[<<<+>>>-]+++<[->-[>+>>]>[+[-<+>]>+>>]<<<<<]>[-]>>[-]<->+<[>-]>[<<<+>>>-
>]<<[-]<<<[>[>+<-]<-]>[-]>[<<+>>-]<<[>>++++[<++++++++>-]<.[-]<<[-]<[-]<<<->>>>>-
]<<<-]<<[>+>+<<-]>[<+>-]>[>[>>+<<-]>>>+++<[->-[>+>>]>[+[-<+>]>+>>]<<<<<]>[-]>[-]
>[<<<<<+>>>>>-]<<<+++<[->-[>+>>]>[+[-<+>]>+>>]<<<<<]>[-]>[-]>[<<<+>>>-]<<<<[>>+>
+<<<-]>>>[<<<+>>>-]<<[>>+>+<<<-]>>>[<<<+>>>-]<<[>[>+<-]<-]>[-]+>[[-]<->]<[->+<]>
[<<+>>-]<<[>>+++++[<+++++++>-]<.[-]<<[-]<[-]<<<->>>>>-]<<<-]<<]<-]++++++++++.[-]
<-]</lang>
 
{{out}}
<pre>###########################
# ## ## ## ## ## ## ## ## #
###########################
### ###### ###### ###
# # # ## # # ## # # #
### ###### ###### ###
###########################
# ## ## ## ## ## ## ## ## #
###########################
######### #########
# ## ## # # ## ## #
######### #########
### ### ### ###
# # # # # # # #
### ### ### ###
######### #########
# ## ## # # ## ## #
######### #########
###########################
# ## ## ## ## ## ## ## ## #
###########################
### ###### ###### ###
# # # ## # # ## # # #
### ###### ###### ###
###########################
# ## ## ## ## ## ## ## ## #
###########################</pre>
 
=={{header|C}}==
If you write coordinates of any point on the carpet in base 3, the pixel if blank if and only if any matching pair of digits are (1, 1).
Anonymous user
Cookies help us deliver our services. By using our services, you agree to our use of cookies.