add action function in main.py

refactor of cmd action into hive.py
added unplayedpieces logic