Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions .github/labeler.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
AnyChange:
- changed-files:
- any-glob-to-any-file: '**'

python:
- changed-files:
- any-glob-to-any-file: '**/*.py'

docs:
- changed-files:
- any-glob-to-any-file: ['README.md', 'docs/**']
27 changes: 27 additions & 0 deletions source/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
VERSION = 1
LOGO = """
███████╗██╗ ██╗ ██████╗ ██╗ ██╗ ██████╗ ███████╗███████╗
██╔════╝██║ ██║██╔═══██╗██║ ██║██╔═══██╗██╔════╝██╔════╝
███████╗███████║██║ ██║██║ █╗ ██║██║ ██║█████╗ █████╗
╚════██║██╔══██║██║ ██║██║███╗██║██║ ██║██╔══╝ ██╔══╝
███████║██║ ██║╚██████╔╝╚███╔███╔╝╚██████╔╝██║ ██║
╚══════╝╚═╝ ╚═╝ ╚═════╝ ╚══╝╚══╝ ╚═════╝ ╚═╝ ╚═╝
"""

MENU = """
[1] - Add a match
[2] - View your matches
[3] - Statistics review
[4] - Data export
[5] - Manage coach mode
[6] - About
[7] - Exit

"""

INFO = f"""
{LOGO}
v{VERSION} - meeko 2026
"""

DESCRIPTION = "A simple basketball statistics tracker, written to be easy to use and to be informational.\nhttps://github.com/worthyworm/showoff"
8 changes: 5 additions & 3 deletions source/data_handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,16 +21,18 @@ def add_match(name, date, points, assists, rebounds, blocks, steals, missed, mis
"missedFT": int(missedFT),
"turnovers": int(TO),
"Won": bool(Result)
}
}

db["games"].append(new_game)


def save():
with open('data.json', 'w', encoding='utf-8') as f:
json.dump(db, f, ensure_ascii=False, indent = 4)
json.dump(db, f, ensure_ascii=False, indent=4)


'''
def enableCoachMode(players):
db["coachMode"] = True
for i in range(players):
'''
'''
50 changes: 25 additions & 25 deletions source/main.py
Original file line number Diff line number Diff line change
@@ -1,44 +1,42 @@
import data_handler
import ui_handler
from ui_handler import menu
from ui_handler import Menu
import statistics_handler

VERSION = 1
db = data_handler
ui = ui_handler
stats = statistics_handler
games = data_handler.db["games"]

def main():

def main():
while True:
menu.showInfo(VERSION, False)
user_choice = menu.createMenu()
Menu.show_info(False)
user_choice = Menu.create_menu()

if user_choice == 1:
stats.addMatch()
stats.add_match()
print("Added!")
db.save()
input()
menu.clearScreen()
input("Enter to continue... ")
Menu.clear_screen()

elif user_choice == 2:
gamescount = len(games)
for i in range(gamescount):
print(f"{i + 1} - {str(games[i]["name"])}")
print(f"{i + 1} - {str(games[i]['name'])}")
choice = input("What match to show?(leave blank to exit)\n")
if choice != '' and int(choice) - 1 in range(gamescount):
stats.showStats(int(choice) - 1)
stats.show_stats(int(choice) - 1)
else:
print("Game index out of range.")
input()
menu.clearScreen()
input("Enter to continue... ")
Menu.clear_screen()

elif user_choice == 3:
menu.clearScreen()
stats.statsReview()
input()
menu.clearScreen()
stats.stats_review()
input("Enter to continue... ")
Menu.clear_screen()

elif user_choice == 5:
'''
Expand All @@ -51,18 +49,20 @@ def main():
pass
'''
print("Coach mode is currently under work. Stay tuned for updates")
input()
menu.clearScreen()
input("Enter to continue... ")
Menu.clear_screen()
pass

elif user_choice == 6:
menu.clearScreen()
menu.showInfo(VERSION, True)
input()
menu.clearScreen()
Menu.clear_screen()
Menu.show_info(True)
input("Enter to continue... ")
Menu.clear_screen()
elif user_choice == 7:
break

main()
db.save()
exit(0)

if __name__ == '__main__':
main()
db.save()
exit()
81 changes: 46 additions & 35 deletions source/statistics_handler.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
from pip._internal.utils.misc import tabulate

import data_handler
from tabulate import tabulate

db = data_handler
games = data_handler.db["games"]

def statsReview():

def stats_review():
allPoints = sum(game["points"] for game in games)
allAssists = sum(game["assists"] for game in games)
allRebounds = sum(game["rebounds"] for game in games)
Expand All @@ -14,12 +16,11 @@ def statsReview():
allMissedFreeThrows = sum(game["missedFT"] for game in games)
allTurnOvers = sum(game["turnovers"] for game in games)
allGames = len(games)
efficiency = calculateEfficiency(allPoints, allRebounds, allAssists, allSteals, allBlocks, allMissed, allMissedFreeThrows, allTurnOvers)
efficiency = calculate_efficiency(allPoints, allRebounds, allAssists, allSteals, allBlocks, allMissed,
allMissedFreeThrows, allTurnOvers)
if allGames == 0:
print("You have no saved games.")
return

'''
return '''
Points : {allPoints}
Assists : {allAssists}
Rebounds : {allRebounds}
Expand All @@ -38,39 +39,49 @@ def statsReview():
Turnovers Per game : {allTurnOvers / allGames}
Games : {allGames}
Efficiency : {efficiency}
'''
table = [["Points", allPoints, allPoints / allGames], ["Assists", allAssists, allAssists / allGames], ["Rebounds", allRebounds, allRebounds / allGames], ["Blocks", allBlocks, allBlocks / allGames], ["Steals", allSteals, allSteals / allGames], ["Missed", allMissed, allMissed / allGames], ["Missed Free Throws", allMissedFreeThrows, allMissedFreeThrows / allGames], ["Turnovers", allTurnOvers, allTurnOvers / allGames]]
'''
table = [["Points", allPoints, allPoints / allGames], ["Assists", allAssists, allAssists / allGames],
["Rebounds", allRebounds, allRebounds / allGames], ["Blocks", allBlocks, allBlocks / allGames],
["Steals", allSteals, allSteals / allGames], ["Missed", allMissed, allMissed / allGames],
["Missed Free Throws", allMissedFreeThrows, allMissedFreeThrows / allGames],
["Turnovers", allTurnOvers, allTurnOvers / allGames]]

print(tabulate(table, headers=["Type", "All-time", "Per-Game"]))
print(f"{'STAT':<20} {'ALL-TIME':<10} {'PER-GAME'}")
print("─" * 35)
for stat, ag, pg in table:
print(f"{stat:<20} {ag:<10} {pg}")
print("─" * 35)
print(f"Games: {allGames}\nEfficiency: {efficiency}")

def addMatch():
print("─" * 35)


def add_match():
db.add_match(input("Enter name for a match: "),
input("Enter date: "),
int(input("Enter points: ")),
int(input("Enter assists: ")),
int(input("Enter rebounds: ")),
int(input("Enter blocks: ")),
int(input("Enter steals: ")),
int(input("Enter missed shots excluding free throws: ")),
int(input("Enter missed free throws: ")),
int(input("Enter turnovers: ")),
bool(input("Result (True for W/False for L): ")))
input("Enter date: "),
int(input("Enter points: ")),
int(input("Enter assists: ")),
int(input("Enter rebounds: ")),
int(input("Enter blocks: ")),
int(input("Enter steals: ")),
int(input("Enter missed shots excluding free throws: ")),
int(input("Enter missed free throws: ")),
int(input("Enter turnovers: ")),
bool(input("Result (True for W/False for L): ")))


def calculateEfficiency(points, rebounds, assists, steals, blocks, missed, missedFT, turnovers):
def calculate_efficiency(points, rebounds, assists, steals, blocks, missed, missedFT, turnovers):
efficiency = (points + rebounds + assists + steals + blocks) - (missed + missedFT + turnovers)
return efficiency

def showStats(matchIndex):
'''
Points : {str(games[matchIndex]["points"])}
Assists : {str(games[matchIndex]["assists"])}
Rebounds : {str(games[matchIndex]["rebounds"])}
Blocks : {str(games[matchIndex]["blocks"])}
Steals : {str(games[matchIndex]["steals"])}
Shots Missed : {str(games[matchIndex]["missed"])}
Free Throws Missed : {str(games[matchIndex]["missedFT"])}
Turnovers : {str(games[matchIndex]["turnovers"])}
'''
table = [["Points", str(games[matchIndex]["points"])], ["Assists", str(games[matchIndex]["assists"])], ["Rebounds", str(games[matchIndex]["rebounds"])], ["Blocks", str(games[matchIndex]["blocks"])], ["Steals", str(games[matchIndex]["steals"])], ["Missed", str(games[matchIndex]["missed"])], ["Missed Free Throws", str(games[matchIndex]["missedFT"])], ["Turnovers", str(games[matchIndex]["turnovers"])], ["Won", str(games[matchIndex]["Won"])]]
print(tabulate(table))

def show_stats(matchIndex):
table = [["Points", str(games[matchIndex]["points"])], ["Assists", str(games[matchIndex]["assists"])],
["Rebounds", str(games[matchIndex]["rebounds"])], ["Blocks", str(games[matchIndex]["blocks"])],
["Steals", str(games[matchIndex]["steals"])], ["Missed", str(games[matchIndex]["missed"])],
["Missed Free Throws", str(games[matchIndex]["missedFT"])],
["Turnovers", str(games[matchIndex]["turnovers"])], ["Won", str(games[matchIndex]["Won"])]]
print(f"{'STAT':<20} {'VALUE'}")
print("─" * 35)
for stat, value in table:
print(f"{stat:<20} {value}")
print("─" * 35)
53 changes: 15 additions & 38 deletions source/ui_handler.py
Original file line number Diff line number Diff line change
@@ -1,46 +1,23 @@
import os

class menu:

def createMenu():
from source import MENU, INFO, DESCRIPTION

choice = int(input('''
[1] - Add a match
[2] - View your matches
[3] - Statistics review
[4] - Data export
[5] - Manage coach mode
[6] - About
[7] - Exit
>'''))

class Menu:

@staticmethod
def create_menu():
print(MENU)
choice = int(input("Select >> "))
return choice


def showInfo(version, full):
@staticmethod
def show_info(full):
if full == False:
print(f'''
███████╗██╗ ██╗ ██████╗ ██╗ ██╗ ██████╗ ███████╗███████╗
██╔════╝██║ ██║██╔═══██╗██║ ██║██╔═══██╗██╔════╝██╔════╝
███████╗███████║██║ ██║██║ █╗ ██║██║ ██║█████╗ █████╗
╚════██║██╔══██║██║ ██║██║███╗██║██║ ██║██╔══╝ ██╔══╝
███████║██║ ██║╚██████╔╝╚███╔███╔╝╚██████╔╝██║ ██║
╚══════╝╚═╝ ╚═╝ ╚═════╝ ╚══╝╚══╝ ╚═════╝ ╚═╝ ╚═╝

v{version} - meeko 2026
''')
print(INFO)
else:
print(f'''
███████╗██╗ ██╗ ██████╗ ██╗ ██╗ ██████╗ ███████╗███████╗
██╔════╝██║ ██║██╔═══██╗██║ ██║██╔═══██╗██╔════╝██╔════╝
███████╗███████║██║ ██║██║ █╗ ██║██║ ██║█████╗ █████╗
╚════██║██╔══██║██║ ██║██║███╗██║██║ ██║██╔══╝ ██╔══╝
███████║██║ ██║╚██████╔╝╚███╔███╔╝╚██████╔╝██║ ██║
╚══════╝╚═╝ ╚═╝ ╚═════╝ ╚══╝╚══╝ ╚═════╝ ╚═╝ ╚═╝
print(INFO, DESCRIPTION)

v{version} - meeko 2026
A simple basketball statistics tracker, written to be easy to use and to be informational.
https://github.com/worthyworm/showoff
''')

def clearScreen():
os.system('cls' if os.name == 'nt' else 'clear')
@staticmethod
def clear_screen():
os.system('cls' if os.name == 'nt' else 'clear')
Loading