def generatePicBoard(picList):
# This function returns a randomly generated picture board
# consisting of a list of image file names

def displayPicBoard(w,board):
# This function displays the 16 images in board on canvas w 
# in a 4x4 matrix

def convertClickToIndex(click):
# This converts click to the corresponding index between 1 and 16

def main():

  picList = ['p1.jpg','p2.jpg','p3.jpg','p4.jpg',
             'p5.jpg','p6.jpg','p7.jpg','p8.jpg']

  hideBoard = ['1.jpg','2.jpg','3.jpg','4.jpg',
               '5.jpg','6.jpg','7.jpg','8.jpg',
               '9.jpg','10.jpg','11.jpg','12.jpg',
               '13.jpg','14.jpg','15.jpg','16.jpg']

  winBoard = ['win.jpg','win.jpg','win.jpg','win.jpg',
              'win.jpg','win.jpg','win.jpg','win.jpg',
              'win.jpg','win.jpg','win.jpg','win.jpg',
              'win.jpg','win.jpg','win.jpg','win.jpg']

  create graphic window
  generate and display a random picture board 
  wait 3 seconds
  display hide board
  remember start time

  while game is not over:
    read first mouse click
    convert mouse click (x,y) coordinates to index1 1..16
    change image in hide board at index 
    display hide board

    read second mouse click
    convert mouse click (x,y) coordinates to index2 1..16
    change image in hide board at index 
    display hide board

    if image at index 1 is same as image at index 2:
      update images in hide board at index1 and index2 with real images
    else:
      wait 2 seconds 
      update images in hide board at index1 and index2 with number images

    display hide board

  show winning board along with elapsed time
  if mouse is clicked:
    close graphic window