Quantcast
Viewing all articles
Browse latest Browse all 35

Let's Tessellate!

Introduction

From Wikipedia:

A tessellation of a flat surface is the tiling of a plane using one or more geometric shapes, called tiles, with no overlaps and no gaps.

A fairly well known tessellation is shown below:

Image may be NSFW.
Clik here to view.
enter image description here

The rhombi are tiled in a fashion that results in no overlaps or gaps, and simulates interchanging columns of cubes.

Task

Your task is to write a program that tessellates rhombi the same way the image does above. The input for the program will be dimensions of the tessellation: height x width, where width is the amount of columns and height is the amount of rows.

A single cube that is 1 x 1 (3 tiles of rhombi) is represented exactly as so:

    _____  /\      \ /  \      \/    \ _____\ \    /      / \  /      /    \/_____ /   

So if the input/dimensions are 3 x 2, this should be the output:

    _____  /\      \ /  \      \/    \ _____\ _____\    /      /\      \ \  /      /  \      \  \/_____ /    \ _____\  /\      \    /      / /  \      \  /      //    \ _____\/_____ /\    /      /\      \ \  /      /  \      \  \/_____ /    \ _____\  /\      \    /      / /  \      \  /      //    \ _____\/_____ /\    /      /\      \ \  /      /  \      \  \/_____ /    \ _____\          \    /      /           \  /      /            \/_____ /

As you can see, there are 3 rows (height), and 2 columns (width). The columns are interchanging up and down. Your program should do this too and start higher. For example, 3 x 3 would be:

    _____               _____  /\      \           /\      \ /  \      \         /  \      \/    \ _____\ _____ /    \ _____\\    /      /\      \    /      / \  /      /  \      \  /      /  \/_____ /    \ _____\/_____ /  /\      \    /      /\      \ /  \      \  /      /  \      \/    \ _____\/_____ /    \ _____\\    /      /\      \    /      / \  /      /  \      \  /      /  \/_____ /    \ _____\/_____ /  /\      \    /      /\      \ /  \      \  /      /  \      \/    \ _____\/_____ /    \ _____\\    /      /\      \    /      / \  /      /  \      \  /      /  \/_____ /    \ _____\/_____ /          \    /      /           \  /      /            \/_____ /

Rules

  • The result must be outputted, input may be taken in whatever way you like but must correspond to height and width
  • Trailing newlines are allowed
  • The tessellation columns always start from above then alternate up and down
  • Sides of tessellations must be shared and tessellations must be correctly placed in between the other columns with no gaps
  • Your submission may be a function or a full program
  • Your program must print exactly the output above given the same input; in other words the output must follow the same format for cubes/tessellations

Assumptions

  • You can assume that the input will always be greater than 1 x 1, so you don't need cases where a zero is inputted

Scoring

This is , so the shortest code in bytes wins. Standard loopholes are prohibited as well.


Viewing all articles
Browse latest Browse all 35

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>