Skip to content

Commit

Permalink
Added support for route names (#4)
Browse files Browse the repository at this point in the history
* Added support for auto-completion on route names.

* Added notes to play tiles.

* Changed formation strings to show how often each formation was used.

* Updated README.

* Formatted project and added formatting script.
  • Loading branch information
XaverKlemenschits authored Dec 4, 2021
1 parent 3da00da commit 079fb69
Show file tree
Hide file tree
Showing 11 changed files with 459 additions and 280 deletions.
Binary file added Icon/scaled_perspective_white.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
9 changes: 6 additions & 3 deletions PlayList.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

from Route import Route, RouteList


class PlayList:
def __init__(self):
self.routes = []
Expand All @@ -14,6 +15,7 @@ def __init__(self):
self.progression = []
self.intRec = []
self.distance = []
self.notes = []

def setTeamNames(self, home, away):
self.homeTeam = home
Expand All @@ -27,7 +29,6 @@ def setScore(self, home, away):
self.awayScore = away

def addPlays(self, dict):

for play in dict:
routes = []
for i in range(4):
Expand All @@ -41,10 +42,12 @@ def addPlays(self, dict):
self.progression.append(play.get('yardsTotal', ''))
self.intRec.append(play.get('intendedReceiver', '').upper())
self.distance.append(play.get('distance', ''))
self.notes.append(play.get('notes', ''))

def printAllPlays(self):
for i in range(len(self.routes)):
print("Routes: {}, formation: {}, down: {}, strongside: {}".format(self.routes[i], self.formations[i], self.downs[i], self.sides[i]))
print("Routes: {}, formation: {}, down: {}, strongside: {}".format(
self.routes[i], self.formations[i], self.downs[i], self.sides[i]))

def swapEntry(self, i, j, swappable):
swappable[i], swappable[j] = swappable[j], swappable[i]
Expand All @@ -58,6 +61,7 @@ def swapEntries(self, i, j):
self.swapEntry(i, j, self.progression)
self.swapEntry(i, j, self.intRec)
self.swapEntry(i, j, self.distance)
self.swapEntry(i, j, self.notes)

def sort(self):
n = len(self.routes)
Expand All @@ -68,4 +72,3 @@ def sort(self):
for j in range(n-i-1):
if(self.routes[j] < self.routes[j+1]):
self.swapEntries(j, j+1)

22 changes: 15 additions & 7 deletions PlayStats.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ def swapEntries(self, i, j):
self.swapEntry(i, j, self.progressions)
self.swapEntry(i, j, self.intRecs)
self.swapEntry(i, j, self.distances)
self.swapEntry(i, j, self.notes)

def __init__(self, playList):
self.homeTeam = playList.homeTeam
Expand All @@ -43,20 +44,21 @@ def __init__(self, playList):
self.progressions = []
self.intRecs = []
self.distances = []

self.notes = []

# Calculate stats from the passed playList

# just push 1st element
self.routesList.append(playList.routes[0])
if(playList.sides[0] == "left"):
self.switchStrongSide(self.routesList[-1])
self.occurences.append(1)
downList = [0,0,0,0,0]
downList = [0, 0, 0, 0, 0]
downList[playList.downs[0]-1] = 1
self.downStats.append(downList)
self.formations.append([])
self.formations[-1].append(playList.formations[0])
strongside = [0,0]
strongside = [0, 0]
self.incrementStrongSide(strongside, playList.sides[0])
self.strongSides.append(strongside)
self.clipNumbers.append([])
Expand All @@ -67,6 +69,8 @@ def __init__(self, playList):
self.intRecs[-1].append(playList.intRec[0])
self.distances.append([])
self.distances[-1].append(playList.distance[0])
self.notes.append([])
self.notes[-1].append(playList.notes[0])

last = 0
for i in range(1, len(playList.routes)):
Expand All @@ -79,22 +83,24 @@ def __init__(self, playList):
self.occurences[last] += 1
self.downStats[last][playList.downs[i]-1] += 1
self.formations[last].append(playList.formations[i])
self.incrementStrongSide(self.strongSides[last], playList.sides[i])
self.incrementStrongSide(
self.strongSides[last], playList.sides[i])
self.clipNumbers[last].append(playList.clipNumbers[i])
self.progressions[last].append(playList.progression[i])
self.intRecs[last].append(playList.intRec[i])
self.distances[last].append(playList.distance[i])
self.notes[last].append(playList.notes[i])

# routes are not equal, add new play to list
else:
self.routesList.append(currentRoute)
self.occurences.append(1)
downList = [0,0,0,0,0]
downList = [0, 0, 0, 0, 0]
downList[playList.downs[i]-1] = 1
self.downStats.append(downList)
self.formations.append([])
self.formations[-1].append(playList.formations[i])
strongside = [0,0]
strongside = [0, 0]
self.incrementStrongSide(strongside, playList.sides[i])
self.strongSides.append(strongside)
self.clipNumbers.append([])
Expand All @@ -105,6 +111,8 @@ def __init__(self, playList):
self.intRecs[-1].append(playList.intRec[i])
self.distances.append([])
self.distances[-1].append(playList.distance[i])
self.notes.append([])
self.notes[-1].append(playList.notes[i])
last += 1

# bubble sort results after number of occurences
Expand Down Expand Up @@ -136,4 +144,4 @@ def getFormations(self, index):
result = result + ", "
result = result + self.formations[index][i]

return result
return result
92 changes: 56 additions & 36 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,23 +1,34 @@
# Skout - Flagfootball Scouting Analysis Tool

## Using the packaged windows version with VSCode
## Setting up the packaged windows version with VSCode

- Install [VS Code](https://code.visualstudio.com/)
- Download the latest release of Skout from the [Releases Page](https://github.com/XaverKlemenschits/Skout/releases) choosing the correct .zip file for your operating system (for example `Skout_Windows-vx.x.x.zip`)
- Unpack the .zip file containing the `Skout.exe` and `skout.schema.json` into a folder.
- Open this folder in VSCode by clicking on "File" -> "Open Folder..."
- Code-highlighting und auto-completion in VSCode must be enabled. See the section below for details.
- Unpack the .zip file containing the `Skout.exe` and `skout.schema.json` into a folder on your computer.
- Open VSCode.
- Inside VSCode click on "File" -> "Open Folder..." and choose the folder you unpacked above.
- On the left side of VSCode you should now see the files contained in this folder. You can open a file by clicking on its name.
- VSCode can automatically list and fill entries, such as formations, strong sides, routes, etc...
If you want this functionality (recommended), see the section `Code Highlighting and Auto Completion in VSCode` below.

## Using the packaged windows version with VSCode

In order to generate your scout file:
- Open VSCode and click on "File" -> "Open Folder..." and open the folder containing `Skout.exe`
- Click on the menu item `Terminal` and then `New Terminal` in VSCode.
- In the terminal, type `Skout.exe example.skout.json` to generate a single `.pdf` file for the example scout.
- A terminal panel was now opened in VSCode.
- In the terminal, type `.\Skout.exe example.skout.json` to generate a single `.pdf` file for the example scout.
- If you are unsure about the use of the program, type the following into the terminal: `.\Skout.exe --help`

**Nota Bene**: If windows stops the execution with a security warning, you can still execute it by clicking on "More info" and then "Run Anyway".

The `Skout.exe` offers a few options to specify e.g. the output filename.
In order to list available options, type `.\Skout.exe --help`

## Code Highlighting and Auto Completion in VSCode

- Press `Ctrl`+`Shift`+`P`. This will open a line at the top of the VSCode window.
- In this line, type "Open Settings" and choose "Preferences: Open Settings (JSON)" from the list of available options.
- In this line, type "Open Settings" and, from the dropdown menu, choose "Preferences: Open Settings (JSON)".
- This will open a new file, which starts with a `{` in the first line.
- After this first `{`, insert the following text:
```json
Expand Down Expand Up @@ -45,35 +56,41 @@ You have to specify a strongside for each play, if none is given, **strong right
### Route numbers

**The numbering of receivers depends on the strongside**: The receivers are always listed from left to right looking into the direction of progression.
Therefore, the order the routes should be given in changes depending on the strong side:
- strong right: ACBD
- strong left: ABCD
- trips right: CABD
- trips left: ABDC

When specifying the routes, you have to use numbers since route names are not recognized. The numbers for the specific routes are listed below.

- 0 "Stop",
- 1 "Quick Out",
- 2 "Slant",
- 3 "Comeback Out",
- 4 "Comeback In",
- 5 "10 Out",
- 6 "10 In",
- 7 "Corner",
- 8 "Post",
- 9 "Go",
- 10 "5 In",
- 11 "5 Out",
- 12 "Pivot",
- 13 "Post-Corner",
- 14 "Reverse",
- 15 "Quick In",
- 16 "Yoyo",
- 17 "Stop&Go"
- 18 "Out&Up"
- 19 "Post Comeback"
- 20 "Screen"
Therefore, the order of the routes changes depending on the strong side and formation:
| Formation | Order |
| -- | -- |
| strong right | ACBD |
| strong left | ABCD |
| trips right | CABD |
| trips left | ABDC |

When specifying the routes, you can use the route name or their corresponding IDs.
We recommend using the route names in combination with an editor capable of auto completion, as described above.
Currently the following routes are supported:

| Route ID | Route Name |
| -- | -- |
| 0 | "Stop", |
| 1 | "Quick Out", |
| 2 | "Slant", |
| 3 | "Comeback Out", |
| 4 | "Comeback In", |
| 5 | "10 Out", |
| 6 | "10 In", |
| 7 | "Corner", |
| 8 | "Post", |
| 9 | "Go", |
| 10| "5 In", |
| 11| "5 Out", |
| 12| "Pivot", |
| 13| "Post-Corner", |
| 14| "Reverse", |
| 15| "Quick In", |
| 16| "Yoyo", |
| 17| "Stop&Go" |
| 18| "Out&Up" |
| 19| "Post Comeback" |
| 20| "Screen" |

## Using the packaged Windows version without VSCode

Expand Down Expand Up @@ -124,7 +141,10 @@ For all available options, look at `skout.schema.json`.

## Contributing

Have a look at `TODO.md` for a list of missing features if you want to contribute. Bug reports, pull requests and feature requests should be filed on GitHub.
Before a pull request can be merged, make sure all files have been formatted using `autopep8`.
The file `format_project.sh` does this automatically.

Bug reports, pull requests and feature requests should be filed on GitHub.

## License

Expand Down
3 changes: 1 addition & 2 deletions Route.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,7 @@ class Route:
"Screen", # 20
]
# coordinates for the lines describing the routes
routeCoords = [[[0, 6],
[-1, 5]],
routeCoords = [[[0, 6], [-1, 5]],
[[4, 1]],
[[-4, 3]],
[[0, 12], [1, 10]],
Expand Down
Loading

0 comments on commit 079fb69

Please sign in to comment.