Baklava in Every Language

Published on 01 November 2018 (Updated: 18 May 2022)

Baklava in Every Language

Welcome to the Baklava page! Here, you'll find a description of the project as well as a list of sample programs written in various languages.

Description

Baklava is a Turkish dessert, and its shape is like an equilateral quadrangle. It is used as an example for programming education in Turkish schools.

In general, this solution can be accomplished using a pair of loops. Of course, all possible programs are welcome.

Requirements

For simplicity, Baklava requires no inputs and can be executed in some form as follows:

$ ./baklava.lang

The following is the expected output:

           *
          ***
         *****
        *******
       *********
      ***********
     *************
    ***************
   *****************
  *******************
 *********************
  *******************
   *****************
    ***************
     *************
      ***********
       *********
        *******
         *****
          ***
           *
  1. The shape should be symmetrical both horizontally and vertically
  2. Each subsequent line should either add or remove padding by one character on both sides
  3. Whitespace should be adjusted accordingly in order to properly output the shape

Testing

Every project in the Sample Programs repo should be tested. In this section, we specify the set of tests specific to Baklava. To keep things simple, we split up testing into two subsets: valid and invalid. Valid tests refer to tests that occur under correct input conditions. Invalid tests refer to tests that occur on bad input (e.g., letters instead of numbers).

Valid Tests

Verify that the actual output matches the expected output (see requirements).

Invalid Tests

Baklava has no input, so there are no invalid test cases.

Articles