Skip to content

Instantly share code, notes, and snippets.

@SpaceVoyager
Created February 15, 2016 15:05
Show Gist options
  • Save SpaceVoyager/bf8821df344006b8a824 to your computer and use it in GitHub Desktop.
Save SpaceVoyager/bf8821df344006b8a824 to your computer and use it in GitHub Desktop.
eightqueens_0.1.py
# The eight queens puzzle game
import ui
v = ui.View(background_color=(0.40, 0.80, 1.00))
board = ui.View()
v.add_subview(board)
v.present('full_screen', hide_title_bar=False , orientations=['landscape'])
#steps_label = ui.Label()
#steps_label.frame = (30, 30, 250, 70)
#steps_label.background_color = (1.00, 0.00, 0.50)
#steps_label.font = ('Futura-CondensedExtraBold', 40)
#steps_label.text = ' Steps: 0'
#v.add_subview(steps_label)
board.frame = (v.width-v.height, 0, v.height, v.height)
board.border_width = 3
board.border_color = (0,0,0)
board.background_color = (1,1,1)
buttons = []
def button_pressed(sender):
return
for r in range(8):
for c in range(8):
button = ui.Button(title='')
if c % 2 == 0:
button.background_color = (0.50, 0.25, 0.00)
else:
button.background_color = (1.00, 0.90, 0.70)
button.width = v.height/8
button.height = button.width
button.border_color = (0,0,0)
button.border_width = 1
button.x = button.width*c
button.y = button.height*r
button.action = button_pressed
button.background_image = ui.Image.named('Snowman_Without_Snow')
board.add_subview(button)
buttons.append(button)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment