Creating Tetris in Python with pygame - Beginner Tutorial (OOP)

แชร์
ฝัง
  • เผยแพร่เมื่อ 4 ก.พ. 2025

ความคิดเห็น • 127

  • @programmingwithnick
    @programmingwithnick  6 หลายเดือนก่อน

    I hope you took away lots from this video. Let me know below!
    PS: I created a course named "Object Oriented Programming Made Easy"! Sign up at bit.ly/3NaMfg4. I think you will enjoy it!

    • @okoruwaimmaculate4650
      @okoruwaimmaculate4650 6 หลายเดือนก่อน

      What do you do when you have all the functions and the blocks are not responding to it? It is not rotating, moving left or right. In fact not responding to keyboard strokes in general?

    • @okoruwaimmaculate4650
      @okoruwaimmaculate4650 6 หลายเดือนก่อน

      I used print statements and noticed that the keystrokes were working but not changing the movement of the blocks.

    • @flyboyvii
      @flyboyvii 3 หลายเดือนก่อน

      There is still have a chance that the newly spawned block overlap others just before game over. I have modify this line on game.py-> draws function
      if self.block_fits() == True:
      self.current_block.draw(screen, 11, 11)
      to prevent it drawing on the screen.
      Anyway, this is still the best Python Tetris Tutorial I 've ever seen, Great job!

  • @programmingwithnick
    @programmingwithnick  ปีที่แล้ว +28

    Hello guys! I hope you enjoyed the video! There is an error in the code as it appears in the video. In the block.py file the undo_rotation method should be like this:
    def undo_rotation(self):
    self.rotation_state -= 1
    if self.rotation_state == -1:
    self.rotation_state = len(self.cells) - 1
    The error is fixed in the github repository. Sorry for this.

    • @jeffersonfuckner3617
      @jeffersonfuckner3617 ปีที่แล้ว +1

      I was stuck in the error but, then I decided to check on comments and here is the answer. kkk Tks

    • @jeffersonfuckner3617
      @jeffersonfuckner3617 ปีที่แล้ว +1

      I'm now at the automatic droping part.

    • @armandoherrera1717
      @armandoherrera1717 ปีที่แล้ว

      I was stuck in this error lol. I thought it had something to do with me writing it in JavaScript lol. I was panicking. Then I asked chat GPT and it solved it for me, but here was the answer all the time 🤣

    • @mrgary4u819
      @mrgary4u819 9 หลายเดือนก่อน

      Thanks for the fix! I suggest you pin this comment so it's easier to find. Loved the explanation and the attention to every detail.

    • @engineeringwithandy6434
      @engineeringwithandy6434 3 หลายเดือนก่อน

      I was just thinking this wasn't quite right and read down the comments :)

  • @ericleboullenger9348
    @ericleboullenger9348 ปีที่แล้ว +5

    By far the best tutorial on OOP in Python, Pygame. Well done Nick, and thank you very much for all your work!

  • @ThatGuyAndres13
    @ThatGuyAndres13 ปีที่แล้ว +10

    I love how you go into detail with this video about the code, I just started python yesterday and I'm doing well because of you! Thank you!

  • @Charlotte-b9w4y
    @Charlotte-b9w4y 4 หลายเดือนก่อน

    I love this tutorial sm. It's not one of those python tutorials where the guy just writes code and doesn't explain it, it's great that u taught us how the code and logic works 😁

  • @shravanpanchal8920
    @shravanpanchal8920 ปีที่แล้ว +7

    Nick, your tutorials are quite unique and quite detailed, I love your videos man, I think it is much better than other similar projects on youtube, and I have a request : could you please make more of such python game or other python projects, it would be very fun to learn from you.
    💯

  • @MinhNhateptrai
    @MinhNhateptrai 4 หลายเดือนก่อน

    By far the best tutorial on OOP in Python, Pygame. Well done Nick, and thank you very much for all your work!

  • @paulotrano103
    @paulotrano103 6 หลายเดือนก่อน +1

    This was honestly really fun to code, I'm currently trying to get in more practice for coding in Python and this was a nice side project to work on, hopefully you make more tutorials like this.

  • @helloworld9531
    @helloworld9531 4 หลายเดือนก่อน

    One of the best tutorials I have ever seen. A simple, to-the-point explanation ...................
    Thank you for such a wonderful course
    🙌🙌🙌

  • @DandaMan2022
    @DandaMan2022 7 หลายเดือนก่อน +6

    This was really easy to follow and fun to program! One thing I did after is adding a storage function like in modern Tetris games. You have a window on the right for which block you are storing (you can store e.g by pressing shift) and can replace your current block with that block. You can't replace a current block that you have stored though.

  • @frankspaceyhelder
    @frankspaceyhelder 4 หลายเดือนก่อน

    Great tutorial. Was able to do it and really happy with how it came out! Thanks

  • @Flanx-ul5hj
    @Flanx-ul5hj 9 หลายเดือนก่อน

    Finally understood how object oriented programming works, thanks a lot!!

  • @neomatrix-1
    @neomatrix-1 8 หลายเดือนก่อน

    this was insanely helpful and helped me grasp a lot of concepts in python. Along with that, it also taught me how to approach different problems and how to implement them inside of python. Thank you so much!

  • @thegrayfox666
    @thegrayfox666 ปีที่แล้ว +1

    I really enjoyed working on this project alonside. Thank you! :D

  • @commandprompt7171
    @commandprompt7171 ปีที่แล้ว +2

    thank you so much for explaining the game logic with readable code, I was trying to code tetris in both C++ and python by myself, and I was struggling at the move rows down logic and clearing the rows logic, I felt like I was going insane, and most of the solutions on google searches are mostly magic values and unreadable code, witch it does not help at all, but your solution by far is the cleanest tetris code I've seen, it might take more code lines, but I do appreciate to be able to read all those class methods.

  • @antoinesadarnac5652
    @antoinesadarnac5652 ปีที่แล้ว +2

    Thank you, I learnt a lot and succeeded in making snake by myself after this video without any help

  • @Wayko6217
    @Wayko6217 ปีที่แล้ว +3

    Added a function to update the speed after reaching 2000 points and also level. Still have to work on the logic behind it because if the value modules is not equal 0 it doesn't update but if I search other it increases automatically. I moved the GAME_UPDATE to the game.py and added the code below to the update_score section
    if self.score % 2000 == 0:
    self.newSpeed = Game.update_speed(self.newSpeed)
    self.level += 1
    if self.newSpeed > 50:
    pygame.time.set_timer(self.GAME_UPDATE, self.newSpeed)
    else:
    self.newSpeed = 50

    def update_speed(current_speed):
    current_speed -= 10
    return current_speed

  • @claireoneill3955
    @claireoneill3955 ปีที่แล้ว

    This tutorial was a really good starting point for my Tetris project. Thanks so much for the help!

  • @ItsMeKippun
    @ItsMeKippun ปีที่แล้ว +1

    nice work dude!, now i can finish my college final tasks :)))

  • @gianmarcoferraro2544
    @gianmarcoferraro2544 ปีที่แล้ว

    A very clear and complete tutorial. Thank you

  • @manuelgarciagarcia2501
    @manuelgarciagarcia2501 ปีที่แล้ว

    Excellent tutorial, these videos will serve as a bible for me to consult how to make many types of games. Thank you very much for sharing all this material.

  • @freesoftwares6042
    @freesoftwares6042 9 หลายเดือนก่อน +1

    okay , i subbed and liked , i like this side of youtube

  • @paulthomas1052
    @paulthomas1052 ปีที่แล้ว

    Great demo and fantastic code for this Tetris game. Thanks so much !

  • @jimmyting1103
    @jimmyting1103 9 หลายเดือนก่อน +1

    Hello Nick big fan i am having some trouble with 29:33 with line 22 givingme an error which says -> AttributeError: 'Grid' object has no attribute 'draw' ive looked over atleast 100 times and all of my code is exact as it is on screen at this current time in the video i even completely rewrote all of main.py and grid.py any reason why this is?
    i am using sublime as well

  • @manoloexplaintome6348
    @manoloexplaintome6348 9 หลายเดือนก่อน

    Thank you por making this amazing video. I've enjoyed it a lot.

  • @S-qz4pk
    @S-qz4pk ปีที่แล้ว

    23:01 the color of the back ground which is dark blue doesn’t appear
    and also the list of lists of zeros
    i wrot the same code but nothing appears

  • @Tims_Projects
    @Tims_Projects ปีที่แล้ว

    Great work Nick, it's quite detailed, I will have to watch it in small intervals to take it all in.👍😁👍

    • @programmingwithnick
      @programmingwithnick  ปีที่แล้ว

      Thank you Tim. Yes, it is a quite long video but it will definately help you understand the game mechanics of this ingenius game and a few more advanced programming practices.

  • @anke4347
    @anke4347 ปีที่แล้ว

    This is a fantastic tutorial. Thank you!

  • @SpirosLymperopoulos
    @SpirosLymperopoulos ปีที่แล้ว

    Great video,we learn so much from this channel!

  • @quinnfly1708
    @quinnfly1708 9 หลายเดือนก่อน

    you are the reason i passed my OPP assessment in com sci

    • @programmingwithnick
      @programmingwithnick  9 หลายเดือนก่อน +1

      I am very happy to hear that! Well done!

    • @quinnfly1708
      @quinnfly1708 9 หลายเดือนก่อน

      @@programmingwithnick thank you!!

  • @daisyb1469
    @daisyb1469 ปีที่แล้ว

    In chapter "Rotate the blocks" , method rotate(self), second line - I think it should be: if self.rotation_state == len(self.cells) - 1.

  • @Blazaram
    @Blazaram 2 หลายเดือนก่อน

    Thank you for the video sir :)

  • @서릐-l1n
    @서릐-l1n 3 หลายเดือนก่อน

    Where using Visual Studio, in main.py game_grid = Grid()
    I wrote game_grid.print_grid(), and 'print_grid' appeared in the 'Grid' object. What should I do?

  • @dragonstar78372
    @dragonstar78372 5 หลายเดือนก่อน +2

    Cool tutorial but i can’t seem to make a python file. Its just not an option for some reason😢

  • @nicholasflint9480
    @nicholasflint9480 5 หลายเดือนก่อน

    Nice tutorial! Is there a way to make it so you can hold the down button and have the block move down continuously?

  • @RAKSHITHNPOOJARY
    @RAKSHITHNPOOJARY ปีที่แล้ว +1

    Hi Great video, But i facing an error When move the blocks to left the boundary check is done correctly but when try to move it to the right it goes out of bound .Any reson why it might have occured

  • @ravilapieri
    @ravilapieri 9 หลายเดือนก่อน +1

    Amazing job!! Thank you very much. Could I use this code with my students, with the credit to your work and channel?

    • @programmingwithnick
      @programmingwithnick  9 หลายเดือนก่อน

      Yes, of course. This is why I make these videos. To help as many people as possible to learn programming.

    • @ravilapieri
      @ravilapieri 9 หลายเดือนก่อน

      ​@@programmingwithnick Thank you!!! Your teaching is fantastic and the code is very organized..
      👏👏

  • @oum_iyad
    @oum_iyad 11 หลายเดือนก่อน

    Nice, love Tetris

  • @ks111541
    @ks111541 ปีที่แล้ว +4

    Hi, I found an error. If a block is in it's last rotation state and you try to rotate it when it's not possible then first the rotate function will set the rotation_state to 0 and next the undo_rotation function will decrease the rotation_state by 1, so the index of the dictionary will be -1 which will crash the game. The line in undo_rotation "self.rotation_state -= 1" should be after the if statement in else statement , not before. Besides that, the video is great! Much appreciated!

    • @programmingwithnick
      @programmingwithnick  ปีที่แล้ว +1

      Good catch! You are absolutely right! I totaly missed it. I played the game for hours and never crashed. I looked over this piece of code of hours and never occured to me that the value can become negative. Thanks for sharing!

    • @programmingwithnick
      @programmingwithnick  ปีที่แล้ว +2

      Now, that I recall me, programming this piece of code, I wanted the method to look like this:
      def undo_rotation(self):
      self.rotation_state -= 1
      if self.rotation_state == -1:
      self.rotation_state = len(self.cells) - 1
      which works. I messed up the if statement.

    • @olssonolov
      @olssonolov ปีที่แล้ว +4

      To avoid tis you could also use the mod4-methode:
      def rotate(self):
      self.rotation_state = (self.rotation_state+1)%4
      def undo_rotate(self):
      self.rotation_state = (self.rotation_state-1)%4

    • @hypebeaver4150
      @hypebeaver4150 ปีที่แล้ว

      nice@@olssonolov

    • @hürriyetpalestine
      @hürriyetpalestine 11 หลายเดือนก่อน

      Much better, go from 3 lines to ONLY 1 line@@olssonolov

  • @kookie.dough09
    @kookie.dough09 10 หลายเดือนก่อน

    Hello, thank you for this detailed tutorial for beginners. I just want to point out one thing, I have an error in 56:45:
    AttributeError: 'Tblock' object has no attribute 'column_offset'
    Can anyone please provide me with a solution because I have been stuck on this error for the past 15 minutes.
    Thank you dearly.

    • @kookie.dough09
      @kookie.dough09 10 หลายเดือนก่อน

      (btw I am using VScode which may differ, thank you.)

  • @nuthatchbird6001
    @nuthatchbird6001 18 วันที่ผ่านมา

    Thank you :)

  • @HangThuy-mw2zh
    @HangThuy-mw2zh 7 หลายเดือนก่อน

    WOWWY BOWWY WOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOW.
    Your tutorial so perfecto.

  • @wasgehtdaab
    @wasgehtdaab ปีที่แล้ว

    😎Can you use images instead of colors? I partially managed it myself, but it doesn't work with current_block and next_block.

  • @AshishKumar-of6xe
    @AshishKumar-of6xe 4 หลายเดือนก่อน

    Thank you Nick. It is very helpful. I have a request to you, I do not want to start the game directly. First it gives the option to "Play Now" and when we enter , the game starts and at the end of the end , it should show a messege "Play Again". How do i do it? Please help in this Nick.

  • @IronDragon2940
    @IronDragon2940 ปีที่แล้ว +1

    I keep running into this error
    This is for the grid.py
    return [dark_grey, green, red, orange, yellow, purple, cyan, blue]
    ^
    IndentationError: unindent does not match any outer indentation level
    [Finished in 106ms]

  • @EmirKayaloglu
    @EmirKayaloglu ปีที่แล้ว +1

    FileNotFoundError: No file 'Sounds/rotate.ogg' found in working directory 'C:\Users\Packard bell\Desktop\Python Örneklerim'.
    Unfortunately, I received another error and my game is not working.

    • @GrooveProducciones
      @GrooveProducciones 10 หลายเดือนก่อน

      estas en el directorio incorrecto, ubicate en la carpeta en donde se encuentre el archio correspondiente

  • @Gamnastyle92
    @Gamnastyle92 ปีที่แล้ว

    Somehow there is an error for the sound code although I created a file called Sounds with the music you implemented in.

  • @simple_doodle
    @simple_doodle หลายเดือนก่อน

    After this 49:13
    I couldn't run it, wonder where i got wrong😔

  • @daisyb1469
    @daisyb1469 ปีที่แล้ว +1

    I don't know why my blocks keep going (partially) out of the grid whenever I move them left or right.

    • @nicholasflint9480
      @nicholasflint9480 5 หลายเดือนก่อน +1

      I had the same issue. In game .py in function block_inside, unindent 'return True' once so it lines up with the for loop instead of the if statement

    • @theyellowjacket
      @theyellowjacket 4 หลายเดือนก่อน

      @@nicholasflint9480 thanks man, I was having the same problem. Thanks for the solution

  • @nathanapiag511
    @nathanapiag511 ปีที่แล้ว

    Hello Nick! When I tried running the code by the end of step 5 (moving the blocks) if press any of the 3 keys (move_left, move_right, move down) the program ends with an error saying that the " object 'Game' does not have an attribute "move_left" for example if i press the left key. I have already defined it in the game class same as your code. I don't know what to do I can't progress to step 6 as it cannot properly run and I cannot move the blocks. Thank you

  • @rayhanfathurrizki4154
    @rayhanfathurrizki4154 ปีที่แล้ว +1

    sir, i have an error, when i tried to run, this appeared
    File "c:\Users\asus\Desktop\mencoba game2\main.py", line 29, in
    game.draw(screen)
    File "c:\Users\asus\Desktop\mencoba game2\game.py", line 43, in draw
    self.current_block.draw(screen)
    File "c:\Users\asus\Desktop\mencoba game2\block.py", line 29, in draw
    for tile in tiles:
    TypeError: 'method' object is not iterable
    do u have any suggestion?

    • @programmingwithnick
      @programmingwithnick  ปีที่แล้ว +1

      IN the block.py file you have an error. Check if you have place some () where it not needed. Check your code again very carefully.

  • @trevorgardner9466
    @trevorgardner9466 ปีที่แล้ว

    Great video, I really learned a lot! But I was wondering how I would implement a block holding feature?

  • @entity_dragons2013
    @entity_dragons2013 3 หลายเดือนก่อน

    cannot import name Grid form grid help please

  • @S-qz4pk
    @S-qz4pk ปีที่แล้ว

    Nick I wrote the same codes you wrote but nothing appears on the screen if the game ,even the screan cames quickly and dissappears ,what should i do

    • @WormPancake
      @WormPancake 11 หลายเดือนก่อน

      Make sure you have your lines of code lined up

  • @itsmanyashukla2546
    @itsmanyashukla2546 ปีที่แล้ว

    continuosly showing this error to me ->
    in grid.py file under the def draw method
    pygame.draw.rect(screen , self.colors[cell_value] , cell_value)
    TypeError: rect argument is invalid
    also game screen is disappearing immediately but before making grid.py it was staying on the window unless i click the red cross...
    can you help me out real quick please!!!!

  • @geencaiilemalaguena2474
    @geencaiilemalaguena2474 ปีที่แล้ว

    heeeeeeeelp someone help me writing the codes in vs code and in line 13 it says "sys" not defined Pylance, is it normal?what should i do?

  • @netaduvinsky2833
    @netaduvinsky2833 9 หลายเดือนก่อน

    Hi nick I have a problem whit the creating blocks
    Can you help me?

  • @charlessastrillo5444
    @charlessastrillo5444 หลายเดือนก่อน

    im having a hard time to find the mistake it said this
    tiles = self.cells[self.rotation_state]
    ^^^^^^^^^^
    AttributeError: 'LBlock' object has no attribute 'cells
    i know where the wrong but idk how to fix it

  • @zeellynk
    @zeellynk 9 หลายเดือนก่อน

    Please could someone show me how to do the Grid file import, I use pycharm, so the ctrl n and ctrl s thing didn't work. Thanks

  • @fvelez78
    @fvelez78 ปีที่แล้ว

    Hi, great tutorial... I´m doing this... however I´ve a problem... when I move the block to right, this one is left out by a rectangle. I print positions into the for of the get_cell_positions method and for LBlock in the initil position after moving evrything to the right the position are: (0,16)(1,16)(1,17)(1,18)...plopppp... Why the column are greater than 10?

    • @fvelez78
      @fvelez78 ปีที่แล้ว

      solved...

  • @EmirKayaloglu
    @EmirKayaloglu ปีที่แล้ว +1

    if self.grid[row][column] == 0:
    ~~~~~~~~~^^^^^
    IndexError: list index out of range
    First of all, it's a great example, I'm almost at the end of the game, but I can't get rid of this mistake, please help

  • @isaacleydon7301
    @isaacleydon7301 ปีที่แล้ว

    Mine has a problem where after 7 blocks have landed another block doesn't spawn. Any idea what might be wrong?

    • @programmingwithnick
      @programmingwithnick  ปีที่แล้ว +1

      Maybe you have forgotten to recreate the blocks list. Give it a check.

  • @nymaztek0315
    @nymaztek0315 ปีที่แล้ว

    I am a newb to coding. How do I add a hard drop if the space bar is hit in this code? If anyone is able to help I would appreciate it

  • @robin3883
    @robin3883 ปีที่แล้ว +2

    i have found a new solution for undo method. for example, when rotating at the edge, it should rotate and move the block inside the screen.
    my code is:
    def rotate_block(self):
    self.current_block.rotate_block()
    while self.block_in_screen() == False:
    self.current_block.move(0,1)
    seems unnecessary but hope it helps

  • @Nothern-p2e
    @Nothern-p2e 6 หลายเดือนก่อน

    It says sys is not defined

  • @alejo_skrt772
    @alejo_skrt772 9 หลายเดือนก่อน

    Thank you!!!!

  • @edm8535
    @edm8535 ปีที่แล้ว

    Hi. Just finnished the "Checking for Collisons" part of your video. Everything went great until I realized that if the user moves a piece into another piece from either left or right, it intertwines and locks in place. Do you have a fix for this? I'll continue on in the video in hope that maybe you also get this error. If not, hopefully you can get back to me. Thanks in advance!

    • @programmingwithnick
      @programmingwithnick  ปีที่แล้ว +2

      I fix this problem in the video in the Checking for Collisons chapter. Are you sure you finished watching it?

    • @edm8535
      @edm8535 ปีที่แล้ว +1

      @@programmingwithnick Hi, you are correct. Seems I ran into the problem and stopped paying attention to you explaining the fix. Thanks for the help.

  • @practicalbong1497
    @practicalbong1497 ปีที่แล้ว

    absolutely amazing

  • @RanaaMohsen
    @RanaaMohsen ปีที่แล้ว

    Traceback (most recent call last):
    File "/Users/mac/PycharmProjects/gamee/r2.py", line 19, in
    blockk = LBlock()
    ^^^^^^^^
    File "/Users/mac/PycharmProjects/gamee/blocks.py", line 7, in __init__
    super().__init__(1)
    TypeError: Block.__init__() takes 1 positional argument but 2 were given
    I keep getting this error and i dont know how to fix it even though i wrote every single line as the video

  • @czeedgj
    @czeedgj 2 หลายเดือนก่อน

    there is an error in mine in making the blocks: Exception has occurred: TypeError
    Block.__init__() got an unexpected keyword argument 'id'
    File "C:\Users\Zeedg\Desktop\Tetris\Blocks.py", line 6, in __init__
    super().__init__(id = 1)
    ~~~~~~~~~~~~~~~~^^^^^^^^
    File "C:\Users\Zeedg\Desktop\Tetris\main.py", line 15, in
    block = LBlock()
    TypeError: Block.__init__() got an unexpected keyword argument 'id'

  • @gauravdhamsekar3802
    @gauravdhamsekar3802 ปีที่แล้ว

    Array are used?

  • @shubham7854
    @shubham7854 3 หลายเดือนก่อน

    thanksyou

  • @Abubakr2007
    @Abubakr2007 ปีที่แล้ว +1

    What software did you use to code?

  • @GamingGOATS-ly4kf
    @GamingGOATS-ly4kf ปีที่แล้ว

    when I try to import grid from Grid it gives me import error

  • @Rahasmayaikahaniyan
    @Rahasmayaikahaniyan ปีที่แล้ว

    Please share the Source code of this game

  • @amrnagy248
    @amrnagy248 ปีที่แล้ว

    he tell me the attribute print_grid isnt exist

  • @DaCom3AK
    @DaCom3AK ปีที่แล้ว +25

    watch with 1.25x speed, thank me later

    • @princeshantu2480
      @princeshantu2480 9 หลายเดือนก่อน +2

      I am watching in 1.5x 😂

  • @wasgehtdaab
    @wasgehtdaab ปีที่แล้ว

    😎

  • @kapykta842
    @kapykta842 11 หลายเดือนก่อน

    very hard tutorial

  • @andrewanimatesstuff
    @andrewanimatesstuff ปีที่แล้ว

    by the time i got to 49:37 i got an error at blocks.py
    Block.__init__() got an unexpected keyword argument 'id'
    heres the code:
    from block import Block
    from position import Position
    class LBlock(Block):
    def __init__(self):
    super().__init__(id = 1)
    self.cells = {
    0: [Position(0, 2), Position(1, 0), Position(1, 1), Position(1, 2)],
    1: [Position(0, 1), Position(1, 1), Position(2, 1), Position(2, 2)],
    2: [Position(1, 0), Position(1, 1), Position(1, 2), Position(2, 0)],
    3: [Position(0, 0), Position(0, 1), Position(1, 1), Position(2, 1)]
    }
    can anyone help?

    • @gasoline27
      @gasoline27 10 หลายเดือนก่อน

      Have you solved the problem yet?

  • @iamgoodatme
    @iamgoodatme 5 หลายเดือนก่อน

    Thank you @DaCom3AK

  • @Rafael-oq9vu
    @Rafael-oq9vu ปีที่แล้ว +1

    here i am learning python after making a tetris game in c

    • @b.c.34
      @b.c.34 ปีที่แล้ว

      Nice.....i would like to know how you handled the rotation of the shapes....i want to design same using C++....
      Thanks in advance