This repository has been archived by the owner on Jan 21, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
/
checkers.py
71 lines (49 loc) · 1.63 KB
/
checkers.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
from kivy.app import App
from kivy.uix.widget import Widget
from kivy.lang import Builder
from kivy.uix.screenmanager import ScreenManager, Screen
from kivy.uix.button import Button
from kivy.uix.gridlayout import GridLayout
# Hello, this is just for practice
BLACK = (0.3, 0.3, 0.35, 1)
WHITE = (1, 1, 1, 1)
class TitleMenu(Screen):
pass
class SettingsMenu(Screen):
pass
class DifficultySetting(Widget):
pass
class PlayerSetting(Widget):
def select_players(self, player_count: int):
if player_count > 1:
self.ids.count.text = f"{player_count} Players Selected"
else:
self.ids.count.text = f"{player_count} Player Selected"
class Board(Screen):
pass
class Square(Button):
def __init__(self, count):
super(Square, self).__init__()
self.background_normal = ''
self.background_color = BLACK if (count + count//8) % 2 else WHITE
class Screen:
# There will be three screens: title, settings, board.
# A class that keeps track of gamestates will likely be needed.
def __init__(self):
self.sm = ScreenManager()
self.sm.add_widget(TitleMenu(name="menu"))
self.sm.add_widget(SettingsMenu(name="settings"))
layout = GridLayout(cols=8, rows=8)
for i in range(64):
layout.add_widget(Square(i))
b = Board(name='board')
b.add_widget(layout)
self.sm.add_widget(b)
def get_manager(self):
return self.sm
class Application(App):
def build(self):
Builder.load_file("checkers.kv")
return Screen().get_manager()
if __name__ == "__main__":
Application().run()