Advertisement
here2share

# Scrabble.py ZZZ

Mar 17th, 2018
240
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 3.04 KB | None | 0 0
  1. # Scrabble.py ZZZ
  2.  
  3. from Tkinter import *
  4. root = Tk()
  5. root.resizable(0,0)
  6. root.title("Scrabble")
  7. root.geometry("%dx%d%+d%+d" % (250, 250, 1, 1))
  8.  
  9. from random import randint, choice, shuffle
  10. from string import ascii_uppercase
  11. from sys import exit
  12.  
  13. class Cv(): 0
  14. cv = Cv()
  15.  
  16. # Tiles in "bag"
  17. global distribution
  18. distribution = list('aaaaaaaaabbccddddeeeeeeeeeeeeffggghhiiiiiiiiijkllllmmnnnnnnooooooooppqrrrrrrssssttttttuuuuvvwwxyyz??')
  19. #
  20.  
  21. board = [
  22.     ['TWS', '   ', '   ', 'DLS', '   ', '   ', '   ', 'TWS', '   ', '   ', '   ', 'DLS', '   ', '   ', 'TWS'],
  23.     ['   ', 'DWS', '   ', '   ', '   ', 'TLS', '   ', '   ', '   ', '   ', '   ', '   ', '   ', 'DWS', '   '],
  24.     ['   ', '   ', 'DWS', '   ', '   ', '   ', 'DLS', '   ', 'DLS', '   ', '   ', '   ', 'DWS', '   ', '   '],
  25.     ['DLS', '   ', '   ', 'DWS', '   ', '   ', '   ', 'DLS', '   ', '   ', '   ', 'DWS', '   ', '   ', 'DLS'],
  26.     ['   ', '   ', '   ', '   ', 'DWS', '   ', '   ', '   ', '   ', '   ', 'DWS', '   ', '   ', '   ', '   '],
  27.     ['   ', 'TLS', '   ', '   ', '   ', 'TLS', '   ', '   ', '   ', 'TLS', '   ', '   ', '   ', 'TLS', '   '],
  28.     ['   ', '   ', 'DLS', '   ', '   ', '   ', 'DLS', '   ', 'DLS', '   ', '   ', '   ', 'DLS', '   ', '   '],
  29.     ['TWS', '   ', '   ', 'DLS', '   ', '   ', '   ', ' * ', '   ', '   ', '   ', 'DLS', '   ', '   ', 'TWS'],
  30.     ['   ', '   ', 'DLS', '   ', '   ', '   ', 'DLS', '   ', 'DLS', '   ', '   ', '   ', 'DLS', '   ', '   '],
  31.     ['   ', 'TLS', '   ', '   ', '   ', 'TLS', '   ', '   ', '   ', 'TLS', '   ', '   ', '   ', 'TLS', '   '],
  32.     ['   ', '   ', '   ', '   ', 'DWS', '   ', '   ', '   ', '   ', '   ', 'DWS', '   ', '   ', '   ', '   '],
  33.     ['DLS', '   ', '   ', 'DWS', '   ', '   ', '   ', 'DLS', '   ', '   ', '   ', 'DWS', '   ', '   ', 'DLS'],
  34.     ['   ', '   ', 'DWS', '   ', '   ', '   ', 'DLS', '   ', 'DLS', '   ', '   ', '   ', 'DWS', '   ', '   '],
  35.     ['   ', 'DWS', '   ', '   ', '   ', 'TLS', '   ', '   ', '   ', '   ', '   ', '   ', '   ', 'DWS', '   '],
  36.     ['TWS', '   ', '   ', 'DLS', '   ', '   ', '   ', 'TWS', '   ', '   ', '   ', 'DLS', '   ', '   ', 'TWS']]
  37.  
  38. scoreBonus = ['TWS', 'DWS', 'TLS', 'DLS']
  39. d = "0 ? 1 aeilnorstu 2 dg 3 bcmp 4 fhvwy 5 k 8 jx 10 qz".split(' ')
  40. scores = {}
  41. while d:
  42.     s,p = d.pop(),d.pop()
  43.     for v in s: scores[v] = int(p)
  44.  
  45. colors = {"TWS":"light red", "DWS":"light purple", "TLS":"light green", "DLS":"light blue", "*":"dark yellow"}
  46.  
  47.  
  48. def exitGame():
  49.     root.destroy()
  50.     exit()
  51.  
  52. root.config(bg='aqua')
  53.  
  54. welcomeLabel = Label(root, text = "Welcome to Scrabble in Python!")
  55. instructionsButton = Button(root, text = "Instructions", command = instructions)
  56. playButton = Button(root, text = "Play", command = play)
  57. playSavedButton = Button(root, text = "Play Saved Game", command = playSavedGame)
  58. exitButton = Button(root, text = "Exit", command = exitGame)
  59.  
  60. welcomeLabel.place(x = 40, y = 20)
  61. instructionsButton.place(x = 40, y = 60)
  62. playButton.place(x = 40, y = 90)
  63. playSavedButton.place(x = 40, y = 120)
  64. exitButton.place(x = 40, y = 150)
  65.  
  66. words = "" # pastebin: sorry, previous went over 512kb limit
  67.  
  68. root.mainloop()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement