Skip to content

About

Print all the classic star patterns in your console with a few loops ☆*: .。. o(≧▽≦)o .。.:*☆

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

41 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 

Repository files navigation

     *
    ***
   *****
  *******
 *********
***********
 *********
  *******
   *****
    ***
     *

star_trees

Print all the classic star patterns in your console with a few loops ☆*: .。. o(≧▽≦)o .。.:*☆

Java

GitHub stars GitHub forks

This repository gathers small Java programs that each draw a star (*) pattern in the console using nested loops: triangles, pyramids, diamonds, squares and more!!! Every pattern is a standalone class with its own main method and no dependencies. (o゜▽゜)o☆

o( ̄▽ ̄)o Usage

Clone the repo, compile all the classes with a JDK (8 or later), then run the pattern you want by its class name:

javac -d out src/*.java
java -cp out DiamondStar

🔄 Customization

Change the size of any pattern by editing the public static constants at the top of its class (NB_LINES, NB_COLUMNS, SIDE_LENGTH, WIDTH, LENGTH), then recompile. For centered shapes, keep NB_COLUMNS equal to 2 * NB_LINES - 1 so the pattern stays symmetric.

✨ Patterns

Triangles

LeftTriangleStar RightTriangleStar ReverseLeftTriangleStar ReverseRightTriangleStar
*
**
***
****
*****
    *
   **
  ***
 ****
*****
*****
****
***
**
*
*****
 ****
  ***
   **
    *

Pyramids

PyramidStar ReversePyramidStar PyramidSpaceStar
     *
    ***
   *****
  *******
 *********
***********
 *********
  *******
   *****
    ***
     *
     *
    * *
   * * *
  * * * *
 * * * * *
HollowPyramidStar ReverseHollowPyramidStar
    *
   * *
  *   *
 *     *
*********
***********
 *       *
  *     *
   *   *
    * *
     *

Diamonds

DiamondStar HollowDiamondStar HalfDiamondStar ReverseHalfDiamondStar
     *
    ***
   *****
  *******
 *********
***********
 *********
  *******
   *****
    ***
     *
     *
    * *
   *   *
  *     *
 *       *
*         *
 *       *
  *     *
   *   *
    * *
     *
*
**
***
****
*****
****
***
**
*
*****
****
***
**
*
**
***
****
*****

Squares and rectangles

SquareStar HollowSquareStar
*****
*****
*****
*****
*****
*****
*   *
*   *
*   *
*****
RectangleStar HollowRectangleStar
********************
********************
********************
********************
********************
********************
*                  *
*                  *
*                  *
********************

Other

PlusStar
    *
    *
*********
    *
    *

📂 Repository structure

star_trees
│
├── src/
│   ├── LeftTriangleStar.java
│   ├── RightTriangleStar.java
│   ├── ReverseLeftTriangleStar.java
│   ├── ReverseRightTriangleStar.java
│   ├── PyramidStar.java
│   ├── ReversePyramidStar.java
│   ├── PyramidSpaceStar.java
│   ├── HollowPyramidStar.java
│   ├── ReverseHollowPyramidStar.java
│   ├── DiamondStar.java
│   ├── HollowDiamondStar.java
│   ├── HalfDiamondStar.java
│   ├── ReverseHalfDiamondStar.java
│   ├── SquareStar.java
│   ├── HollowSquareStar.java
│   ├── RectangleStar.java
│   ├── HollowRectangleStar.java
│   └── PlusStar.java
│
├── README.md
├── LICENSE.md
└── .gitignore

༼ つ ◕_◕ ༽つ Contributors

Contributors

📄 License

Licensed under MIT License. For further information, see the LICENSE file.


Made with ❤️ by SalimMc

⭐ If this repository helped you, you know what to do!

About

Print all the classic star patterns in your console with a few loops ☆*: .。. o(≧▽≦)o .。.:*☆

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages