From acd4c628af2b26fe9b37b224d6ee309dedbe6e80 Mon Sep 17 00:00:00 2001 From: Francesco Bariatti <francesco.bariatti@insa-rennes.fr> Date: Mon, 7 Mar 2016 12:02:39 +0100 Subject: [PATCH] Added tools for debug --- tools/draw.py | 21 +++++++++++++++++++++ tools/penguin.py | 15 +++++++++++++++ 2 files changed, 36 insertions(+) create mode 100755 tools/draw.py create mode 100755 tools/penguin.py diff --git a/tools/draw.py b/tools/draw.py new file mode 100755 index 0000000..d55de83 --- /dev/null +++ b/tools/draw.py @@ -0,0 +1,21 @@ +#!/usr/bin/env python3 +#-*- encoding: utf-8 -*- +import sys + +while True: + bitboard = int(input("Enter board : ")) + + output = [] + + for i in range(59, -1, -1): + if(i % 15 == 14): + output.append("|\n ") + elif(i % 15 == 7): + output.append("|\n") + if((bitboard >> i) & 1 == 1): + output.append("|x") + else: + output.append("| ") + + output.append("|") + print(''.join(output)) diff --git a/tools/penguin.py b/tools/penguin.py new file mode 100755 index 0000000..4a7dc5f --- /dev/null +++ b/tools/penguin.py @@ -0,0 +1,15 @@ +#!/usr/bin/env python3 +#-*- encoding: utf-8 -*- +import sys + +while True: + p = int(input("Enter penguin: ")) + + print("Position: ", p & 63) + print("Nb moves: ", (p >> 6) & 63) + print("Nb moves A: ", (p >> 12) & 7) + print("Nb moves B: ", (p >> 15) & 7) + print("Nb moves C: ", (p >> 18) & 7) + print("Nb moves D: ", (p >> 21) & 7) + print("Nb moves E: ", (p >> 24) & 7) + print("Nb moves F: ", (p >> 27) & 7) -- GitLab