#1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Mar 2013
    Posts
    2
    Rep Power
    0

    Algorithm to Pseudocode


    Code:
     draggingToken = False
        tokenx, tokeny = None, None
        while True:
            for event in pygame.event.get():
                if event.type == QUIT:
                    terminate()
                if not draggingToken and event.type == MOUSEBUTTONDOWN and redPileRect.collidepoint(event.pos):
                    # start of dragging o`n red token pile.
                    draggingToken = True
                if draggingToken and event.type == MOUSEMOTION:
                    # draw red token being dragged
                    tokenx, tokeny = event.pos
                if draggingToken and event.type == MOUSEBUTTONUP:
                    # let go of dragging token.
    
                    if tokeny < YMARGIN and tokenx > XMARGIN and tokenx < WINDOWWIDTH - XMARGIN:
                        # let go at the top of the screen.
                        column = int((tokenx - XMARGIN) / SPACESIZE)
                        if isValidMove(board, column):
                            animateDroppingToken(board, column, 'red')
                            board[column][getLowestFreeSpace(board, column)] = 'red'
                            drawBoard(board)
                            pygame.display.update()
                            return
                    tokenx, tokeny = None, None
                    draggingToken = False
            if tokenx != None and tokeny != None:
                drawBoard(board, {'x':tokenx - int(SPACESIZE / 2), 'y':tokeny - int(SPACESIZE / 2), 'color':'red'})
            else:
                drawBoard(board)
    
            pygame.display.update()
            gameClock.tick()
    How can i make this code to pseudocode?
  2. #2
  3. --
    Devshed Expert (3500 - 3999 posts)

    Join Date
    Jul 2012
    Posts
    3,959
    Rep Power
    1014
    Hi,

    who says this isn't pseudocode already?

    I mean, this task is kind of nonsensical. There is no exact definition of "pseudo code", so nothing prevents you from simply using this very code. Python is actually pretty close to what most people would probably consider to be "pseudo code".

    Is this homework?
    The 6 worst sins of security ē How to (properly) access a MySQL database with PHP

    Why canít I use certain words like "drop" as part of my Security Question answers?
    There are certain words used by hackers to try to gain access to systems and manipulate data; therefore, the following words are restricted: "select," "delete," "update," "insert," "drop" and "null".
  4. #3
  5. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Mar 2013
    Posts
    2
    Rep Power
    0
    no i was just wondering what is a real pseudo-code for this python code i mean i can say this a pseudo-code for me isn't it? because there is no real definition what is a pseudo-code

IMN logo majestic logo threadwatch logo seochat tools logo