Vergelijk commits

...

10 Commits

Auteur SHA1 Bericht Datum
  bertieb c95cc92a36 (Jan 2022) Update for Jan 2022 - FIFA 99 2 jaren geleden
  bertieb fa4f0165a8 (Dec 2021) Update for NHL94 (again!) 2 jaren geleden
  bertieb 373529565b (Oct 2021) Update for BL Cricket 96 3 jaren geleden
  bertieb 695a318777 (Sep 2021) Subs and Teams for Worms Armageddon 3 jaren geleden
  bertieb 70b89273f6 (Sep 2021) Add team randomisation + name-specifics 3 jaren geleden
  bertieb 802228417f Teamicker should respect rows and cols specified 3 jaren geleden
  bertieb b83eb4a9b7 (August 2021) Update to Madden 93 3 jaren geleden
  bertieb f9d8c18d8d (June 2021) Update subs+teams, no split on space 3 jaren geleden
  bertieb 7a9f1e9259 Update to May 2021 Sub Crown - NBA 98 3 jaren geleden
  bertieb 5aa5170d10 Update for March 2021 Sub Crown (Rugby WC95) 3 jaren geleden
3 gewijzigde bestanden met toevoegingen van 115 en 58 verwijderingen
  1. +6
    -6
      subs.txt
  2. +66
    -26
      teampicker.py
  3. +43
    -26
      teams.txt

+ 6
- 6
subs.txt Bestand weergeven

@@ -1,8 +1,8 @@
costello_
idiotictendencies
etho8282
ksyme99
hil42
rarestmonkey
costello_
maothecat
pandacat42
mattgamerguy666
meblu42
burgiuk
idiotictendencies
nightmarewolf3113

+ 66
- 26
teampicker.py Bestand weergeven

@@ -4,7 +4,7 @@
#
# Two files provided:
# - subs.txt -- 8 subscribers
# - teams.txt -- 26 teams
# - teams.txt -- 30 teams
#
# Pseudocode:
# Split screen in 1:3
@@ -19,9 +19,10 @@
import sys
import random
import pygame
import platform

pygame.init()
random.seed("BERTIE BEEF BAGGIO")
random.seed("bertiebdec2021")

HIGHLIGHTEVENT = pygame.USEREVENT + 1 # user specified event
CLEAREVENT = pygame.USEREVENT + 2 # user specified event
@@ -31,9 +32,16 @@ SIZE = WIDTH, HEIGHT = 1920, 1080

BGIMG = pygame.image.load("sub_crown_bg_2.png")

FONT = pygame.font.SysFont("Fetamont", 50)
SUBFONTHEIGHT = 35
SUBFONT = pygame.font.SysFont("Fetamont", SUBFONTHEIGHT)
FONTHEIGHT = 35
SUBFONTHEIGHT = 40

if "Windows" not in platform.system():
SUBFONT = pygame.font.SysFont("Fetamont", SUBFONTHEIGHT)
FONT = pygame.font.SysFont("Fetamont", FONTHEIGHT)
else:
SUBFONT = pygame.font.Font("ffmb10.ttf", SUBFONTHEIGHT)
FONT = pygame.font.Font("ffmb10.ttf", FONTHEIGHT)

OFFWHITE = (224, 224, 224)
HIGHLIGHT = (255, 209, 0)
BLUE = (20, 25, 153)
@@ -41,22 +49,24 @@ RED = (186, 20, 31)
PURPLE = (121, 35, 158)

screen = pygame.display.set_mode(SIZE)
pygame.display.set_caption("Sub Crown Nov 2020 Team Picker")
pygame.display.set_caption("Sub Crown January 2022 Team Picker")

# Set up team text positioning references
#
# 26 teams so 3 cols, 9 rows

COLSTART = int(WIDTH/3)
COLWIDTH = int((WIDTH-COLSTART)/3)

ROWSTART = int(HEIGHT/12)
ROWHEIGHT = int((HEIGHT-ROWSTART)/10)

TEAMSFILE = "teams.txt"

TEAMNUMCOLS = 3
TEAMNUMROWS = 9
TEAMNUMROWS = 15

# COLSTART = int(WIDTH/TEAMNUMCOLS)
COLSTART = int(WIDTH/(TEAMNUMCOLS+1))
COLWIDTH = int((WIDTH-COLSTART)/TEAMNUMCOLS)

ROWSTART = int(HEIGHT/(TEAMNUMROWS+2))
# ROWHEIGHT = int((HEIGHT-ROWSTART)/TEAMNUMROWS)
ROWHEIGHT = int((HEIGHT-ROWSTART)/(TEAMNUMROWS+0))

TEAMCOLS = []
TEAMROWS = []
@@ -72,7 +82,7 @@ for i in range(TEAMNUMROWS):
SUBSFILE = "subs.txt"
SUBS = []

SUBNUMROWS = 8
SUBNUMROWS = 9
SUBROWHEIGHT = int((HEIGHT-ROWSTART)/9)
SUBROWS = []

@@ -138,6 +148,22 @@ class Highlighter(object):
if self.iterations >= self.max:
# Choosing time
self.lastchoice = -1
# # ** Name-specific choices! ** # #
# for tsub in SUBS:
# if tsub.team == "":
# choosing_sub = tsub
# break
# for j in range(len(TEAMS)):
# if "amy" not in choosing_sub.sub:
# if TEAMS[j].team.lower(
# ).startswith(choosing_sub.sub[0].lower()):
# TEAMS[j].choose()
# break
# else:
# if TEAMS[j].team.lower().startswith("a"):
# TEAMS[j].choose()
# break
# # End Name-specific stuff # #
TEAMS[-1].choose()
pygame.time.set_timer(HIGHLIGHTEVENT, 0) # Disable highlight
pygame.time.set_timer(CHOOSEEVENT, 5000, True) # make choice
@@ -152,19 +178,27 @@ def draw_text(text, font, text_col, x, y):
screen.blit(img, (x, y))


def setup_team_board():
def setup_team_board(randomise_teams=False):
"""Grab teams from text file and set their positions"""
teamlist = []

with open(TEAMSFILE, "r") as fh:
for row in range(TEAMNUMROWS):
for col in range(TEAMNUMCOLS):
name = fh.readline().strip()
if name == "":
continue
print("Adding {} at {},{}".format(name,
TEAMCOLS[col],
TEAMROWS[row]))
TEAMS.append(Team(name,
TEAMROWS[row], TEAMCOLS[col]))
teams = fh.readlines()
teamlist = [team.rstrip() for team in teams if team != ""]

if randomise_teams:
random.shuffle(teamlist)

for row in range(TEAMNUMROWS):
for col in range(TEAMNUMCOLS):
if len(teamlist) == 0:
continue
name = teamlist.pop(0)
print("Adding {} at {},{}".format(name,
TEAMCOLS[col],
TEAMROWS[row]))
TEAMS.append(Team(name,
TEAMROWS[row], TEAMCOLS[col]))


def setup_subs():
@@ -182,7 +216,7 @@ for line in open(SUBSFILE, "r"):
print(SUBS)

random.shuffle(SUBS)
setup_team_board()
setup_team_board(randomise_teams=True)
random.shuffle(TEAMS)
setup_subs()

@@ -221,6 +255,12 @@ while True:
elif event.type == CHOOSEEVENT:
for sub in SUBS:
if sub.team == "":
# # Name-specific again # #
# for k in range(len(TEAMS)):
# if TEAMS[k].colour == RED:
# sub.team = TEAMS.pop(k).team
# break
# # End name-specific # #
sub.team = TEAMS.pop().team
pygame.time.set_timer(CLEAREVENT, 100, True)
break


+ 43
- 26
teams.txt Bestand weergeven

@@ -1,26 +1,43 @@
Anaheim
Boston
Buffalo
Calgary
Chicago
Dallas
Detroit
Edmonton
Florida
Hartford
Los Angeles
Montreal
New Jersey
NY Islanders
NY Rangers
Ottawa
Philadelphia
Pittsburgh
Quebec
San Jose
St Louis
Tampa Bay
Toronto
Vancouver
Washington
Winnipeg
China PR
Iran
Japan
Saudi Arabia
South Korea
Cameroon
Morocco
Nigeria
South Africa
Tunisia
Canada
Jamaica
Mexico
United States
Argentina
Brazil
Chile
Colombia
Paraguay
Uruguay
Australia
Austria
Belgium
Bulgaria
Croatia
Czech Republic
Denmark
England
France
Germany
Greece
Ireland
Israel
Italy
Netherlands
Norway
Portugal
Romania
Russia
Scotland
Spain
Sweden
Yugoslavia

Laden…
Annuleren
Opslaan