diff --git a/actual_board.py b/actual_board.py index 72976f6..1ab6aa1 100644 --- a/actual_board.py +++ b/actual_board.py @@ -135,13 +135,23 @@ class Board_painter: def find_pin(self, pos): SPACING = self.SPACING x,y = pos - x -= 50 if x > 550 else 0 - if y < 175: - pin = (13 + int(x / SPACING)) - idx = 1+int(x / SPACING) - elif y > 225: - pin = (12 - int(x / SPACING)) - idx = 13+ int(x / SPACING) + + + if 500 < x < 550: + if y > 225: + pin = 0 + idx = 0 + else: + pin = 25 + idx = 25 + else: + x -= 50 if x > 550 else 0 + if y < 175: + pin = (13 + int(x / SPACING)) + idx = 1+int(x / SPACING) + elif y > 225: + pin = (12 - int(x / SPACING)) + idx = 13+ int(x / SPACING) return pin, idx # Find the y position based on the chosen pin @@ -253,7 +263,9 @@ class Board_painter: if buckets[idx][0] == 0: buckets[idx][1] = 0 - + + print("Location for mouse_down:", self.from_board) + offsets[is_true][0] = rectangles[is_true].x - mouse_x offsets[is_true][1] = rectangles[is_true].y - mouse_y @@ -309,7 +321,7 @@ class Board_painter: # print(move_legal(from_board, buckets, [1,2])) - print("from board:",self.from_board) + # if self.move_legal(self.from_board, buckets, self.roll): pot_board = self.gen_board_from_buckets(buckets) sets = self.calc_move_sets(self.from_board, self.roll, player) @@ -404,47 +416,12 @@ class Board_painter: def test(self): while True: self.paint_board() + pygame.quit() b = Board_painter() b.test() -# class myThread (threading.Thread): -# def __init__(self, threadID, name, counter): -# threading.Thread.__init__(self) -# self.threadID = threadID -# self.name = name -# self.counter = counter -# def run(self, function): -# print ("Starting " + self.name) -# function() -# print ("Exiting " + self.name) - - -# def change_player(): -# while True: -# time.sleep(5) -# b.switch_player([1,2]) - -# def keep_painting(): -# while True: -# b.paint_board() - -# # Create new threads -# thread2 = myThread( keep_painting() ) -# thread1 = myThread( change_player() ) - - -# # Start new Threads -# thread1.start() -# thread2.start() -# thread1.join() -# thread2.join() -# print ("Exiting Main Thread") -# # - end - - -# pygame.quit() -