Skip to content

Commit

Permalink
Merge branch 'main' of github:d120/vorkurs
Browse files Browse the repository at this point in the history
  • Loading branch information
KTuff committed Sep 30, 2024
2 parents 2561f57 + 4644254 commit 38e9d12
Show file tree
Hide file tree
Showing 153 changed files with 2,629 additions and 2,007 deletions.
14 changes: 6 additions & 8 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,13 +31,7 @@ jobs:
# 3. Build the documents
- name: "Build the documents"
run: |
make -j -C lecture compile
make -j -C exercises compile
make -j -C misc/linux_commands compile
mkdir -p pdfout
cp lecture/pdfout/*.pdf pdfout/
cp exercises/pdfout/*.pdf pdfout/
cp misc/linux_commands/pdfout/*.pdf pdfout/
make -j
# 4. Upload artifacts to GitHub
- name: Upload artifacts to GitHub
Expand Down Expand Up @@ -91,5 +85,9 @@ jobs:
path: .
name: Vorkurs-Materialien

- name: Set current year
id: year
run: echo "::set-output name=year::$(date +'%Y')"

- name: Deploy with rsync
run: rsync -avz * ${{ secrets.SSH_USER }}@login.d120.de:public_html
run: rsync -avz * ${{ secrets.SSH_USER }}@login.d120.de:public_html/vorkurs-${{ steps.year.outputs.year }}
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -378,4 +378,7 @@ TSWLatexianTemp*
#*Notes.bib
.secrets
options.cfg

# SVG package
svg-inkscape/
svg-inkscape-*/
1 change: 1 addition & 0 deletions .pep8
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
[pep8]
max-line-length = 120
ignore = E302, E305
1 change: 1 addition & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ repos:
rev: 'v2.3.1' # Use the sha / tag you want to point at
hooks:
- id: autopep8
exclude: ^.*/listings/unformatted/.*\.py$
- repo: https://github.com/editorconfig-checker/editorconfig-checker.python
rev: '3.0.3' # pick a git hash / tag to point to
hooks:
Expand Down
3 changes: 2 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
.DEFAULT_GOAL := all

OUT_DIR := pdfout/
# find all makefiles in subdirectories
MAKEFILES := $(shell find . -mindepth 2 -name 'Makefile' -not -path './.git/*' -not -path './.devcontainer')
MAKEFILES := $(shell find . -mindepth 2 -name 'Makefile' -not -path './.git/**/*' -not -path './.devcontainer/**/*')

$(MAKEFILES:Makefile=Makefile.all):
$(eval MAKEFILE := $(patsubst %.all,%,$@))
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ Neben einer aktuellen TeX Live Distribution wird folgende Software benötigt:
Zur einfachen Erstellung der Inhalte stehen UNIX Makefiles bereit, Details dazu sind den jeweiligen Verzeichnis zu entnehmen.

## Lizenz
Eine Verwendung des Logos der Fachschaft Informatik, TU Darmstadt (`bildmarke_ohne_rand.png`), ist nur für Fachschaftstätigkeiten gestattet.
Eine Verwendung der Logos der Fachschaft Informatik, TU Darmstadt in (`lecture/globalMedia/*.(pdf|svg)`), ist nur für Fachschaftstätigkeiten gestattet.

Alle anderen Inhalte dieses Projekts stehen, sofern nicht anders angegeben, unter der GNU General Public License v3.0 (GNU GPLv3):

Expand Down
2 changes: 1 addition & 1 deletion codingchallenges/2019/TicTacToe.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ def computer_move():


def game_over():
if board.count(player)+board.count(computer) == 9:
if board.count(player) + board.count(computer) == 9:
return True
return False

Expand Down
5 changes: 3 additions & 2 deletions codingchallenges/2019/vorstellung.tex
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
% !TeX root = vorstellung.tex
\input{../../lecture/global}
\logo*{\includegraphics{../../lecture/globalMedia/bildmarke_ohne_rand}}
\logo*{\includegraphics{../../lecture/globalMedia/logo\IfDarkModeT{-dark}.pdf}}
\usepackage{float}
\usepackage{listings}
\usepackage{graphicx}
Expand All @@ -8,7 +9,7 @@

\title[Programmiervorkurs]{Programmiervorkurs Wintersemester 2019/20}
\subtitle{{\small der Fachschaft Informatik}}
%\logo[2]{\includegraphics[scale=5]{../../lecture/globalMedia/bildmarke_ohne_rand}}
%\logo[2]{\includegraphics[scale=5]{../../lecture/globalMedia/logo\IfDarkModeT{-dark}.pdf}}
\author{Vorkursteam der Fachschaft Informatik}
\institute{TU Darmstadt}
\date{Wintersemester 2019}
Expand Down
28 changes: 14 additions & 14 deletions codingchallenges/2021/2048-advanced.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,10 @@

# Translate direction to a vector with length 1 [x, y]
directionVectors = {
"left": [-1, 0],
"down": [0, 1],
"up": [0, -1],
"right": [1, 0],
"left": [-1, 0],
"down": [0, 1],
"up": [0, -1],
"right": [1, 0],
}

x = 69
Expand Down Expand Up @@ -65,7 +65,7 @@ def randint(minimum: int, maximum: int):
t = x ^ ((x << 11) & 0xFFFFFFFF) # 32bit
x, y, z = y, z, w
w = (w ^ (w >> 19)) ^ (t ^ (t >> 8))
return (w % (maximum-minimum+1)) + minimum
return (w % (maximum - minimum + 1)) + minimum


def deepCopy(liste: list):
Expand Down Expand Up @@ -107,19 +107,19 @@ def printField(state: list, style: int = 1, color_new: bool = False, new_fields:
new_fields (list, optional): a list of coordinates(x,y) like:[[1,2],[2,3]]. Defaults to [].
"""
# Add two spaces for stylistic reasons
maxLength = getMaxStringLength(state)+2
maxLength = getMaxStringLength(state) + 2
hlineupper = ""
hlinelower = ""
borderspacer = ""
betweenspacer = ""
if (style == 1):
hlinelower = f"+{('-' * maxLength+'+')*len(state)}\n"
hlinelower = f"+{('-' * maxLength + '+') * len(state)}\n"
print(hlinelower, end='')
borderspacer = "|"
betweenspacer = "|"
else:
hlineupper = f"{('╭' + '-' * maxLength+'╮')*len(state)}\n"
hlinelower = f"{('╰' + '-' * maxLength+'╯')*len(state)}\n"
hlineupper = f"{('╭' + '-' * maxLength + '╮') * len(state)}\n"
hlinelower = f"{('╰' + '-' * maxLength + '╯') * len(state)}\n"
borderspacer = "|"
betweenspacer = "||"
for y, row in enumerate(state):
Expand Down Expand Up @@ -271,7 +271,7 @@ def spawnNewTile(state):
newState = state
emptySlots = getEmptySlots(state)
if (len(emptySlots) > 0):
[newX, newY] = emptySlots[randint(0, len(emptySlots)-1)]
[newX, newY] = emptySlots[randint(0, len(emptySlots) - 1)]
newState[newY][newX] = 4 if randint(1, 10) == 10 else 2
return newState

Expand Down Expand Up @@ -314,7 +314,7 @@ def slideTiles(currentState: list, direction: str):
newState = currentState
[xMov, yMov] = directionVectors.get(direction)
forwardRange = range(len(currentState))
backwardRange = range(len(currentState)-1, -1, -1)
backwardRange = range(len(currentState) - 1, -1, -1)
# Durch Feld Iterieren
# Anmerkung: Hier muss man darauf achten, in welcher Reihenfolge man durch die Felder geht,
# da sonst mehrere Felder auf einmal addiert werden können
Expand All @@ -329,7 +329,7 @@ def slideTiles(currentState: list, direction: str):
# Ansatz: wir gehen solange in die Schieberichtung,
# bis der nächste Schritt außerhalb des Feldes Läge oder wir auf ein nichtleeres Feld stoßen.
for i in range(len(currentState)):
nextPos = [newPos[0]+xMov, newPos[1]+yMov]
nextPos = [newPos[0] + xMov, newPos[1] + yMov]
[nextX, nextY] = nextPos
if not pointIsInGameField(len(currentState), nextX, nextY) or newState[nextY][nextX] != '':
break
Expand All @@ -340,7 +340,7 @@ def slideTiles(currentState: list, direction: str):
# bis der nächste Schritt außerhalb des Feldes Läge oder wir auf ein nichtleeres Feld stoßen.
# Sollten wir auf ein nichtleeres Feld mit dem Gleichen Wert stoßen, haben wir eine Verschmelzposition gefunden.
for i in range(len(currentState)):
prevPos = [newMergePos[0]-xMov, newMergePos[1]-yMov]
prevPos = [newMergePos[0] - xMov, newMergePos[1] - yMov]
[prevX, prevY] = prevPos
if not pointIsInGameField(len(currentState), prevX, prevY):
break
Expand All @@ -357,7 +357,7 @@ def slideTiles(currentState: list, direction: str):
# Wenn das Feld an der Verschmelzposition nicht leer ist,
# müssen wir den Wert des Feldes verdoppeln
if (newState[newMergeY][newMergeX] != ''):
newState[newY][newX] = field+newState[newMergeY][newMergeX]
newState[newY][newX] = field + newState[newMergeY][newMergeX]
newState[newMergeY][newMergeX] = ''
else:
newState[newY][newX] = field
Expand Down
30 changes: 15 additions & 15 deletions codingchallenges/2021/2048-ugly.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,16 +18,16 @@
randomindex = -1
# 100 zufallszahlen
randomints = [
28, 9, 40, 74, 28, 56, 82, 61, 80, 95,
14, 97, 47, 83, 63, 88, 91, 39, 2, 85,
28, 9, 40, 74, 28, 56, 82, 61, 80, 95,
14, 97, 47, 83, 63, 88, 91, 39, 2, 85,
82, 61, 69, 35, 19, 17, 64, 21, 29, 20,
94, 59, 73, 50, 1, 69, 30, 39, 26, 11,
21, 94, 1, 24, 12, 8, 3, 90, 13, 8,
52, 48, 41, 86, 60, 33, 74, 83, 9, 48,
90, 12, 60, 44, 9, 58, 64, 61, 50, 74,
94, 59, 73, 50, 1, 69, 30, 39, 26, 11,
21, 94, 1, 24, 12, 8, 3, 90, 13, 8,
52, 48, 41, 86, 60, 33, 74, 83, 9, 48,
90, 12, 60, 44, 9, 58, 64, 61, 50, 74,
97, 77, 69, 81, 62, 18, 22, 64, 25, 61,
56, 63, 95, 39, 21, 6, 87, 98, 28, 52,
35, 69, 43, 92, 94, 88, 4, 39, 6, 20
56, 63, 95, 39, 21, 6, 87, 98, 28, 52,
35, 69, 43, 92, 94, 88, 4, 39, 6, 20
]


Expand Down Expand Up @@ -93,7 +93,7 @@
for j in i:
feldzeile += str(j)
# Right Padding with space
for k in range(longestString-len(str(j))):
for k in range(longestString - len(str(j))):
feldzeile += " "
feldzeile += "|"
print(feldzeile)
Expand Down Expand Up @@ -155,8 +155,8 @@
# Ansatz: wir gehen solange in die Schieberichtung,
# bis der nächste Schritt außerhalb des Feldes Läge oder wir auf ein nichtleeres Feld stoßen.
for i in range(4):
nextX = newX+xMov
nextY = newY+yMov
nextX = newX + xMov
nextY = newY + yMov
pointIsInGameField = nextX >= 0 and nextX < 4 and nextY >= 0 and nextY < 4
if not pointIsInGameField or newState[nextY][nextX] != 0:
break
Expand All @@ -171,8 +171,8 @@
# bis der nächste Schritt außerhalb des Feldes Läge oder wir auf ein nichtleeres Feld stoßen.
# Sollten wir auf ein nichtleeres Feld mit dem Gleichen Wert stoßen, haben wir eine Verschmelzposition gefunden.
for i in range(4):
prevX = newMergeX-xMov
prevY = newMergeY-yMov
prevX = newMergeX - xMov
prevY = newMergeY - yMov
pointIsInGameField = prevX >= 0 and prevX < 4 and prevY >= 0 and prevY < 4
if not pointIsInGameField:
break
Expand All @@ -186,7 +186,7 @@
# Verschieben an neue Position, und ggf multiplizieren
newState[y][x] = 0
if (newState[newMergeY][newMergeX] != 0):
newState[newY][newX] = 2*field
newState[newY][newX] = 2 * field
newState[newMergeY][newMergeX] = 0
else:
newState[newY][newX] = field
Expand Down Expand Up @@ -259,7 +259,7 @@
for j in i:
feldzeile += str(j)
# Right Padding with space
for k in range(longestString-len(str(j))):
for k in range(longestString - len(str(j))):
feldzeile += " "
feldzeile += "|"
print(feldzeile)
Expand Down
34 changes: 17 additions & 17 deletions codingchallenges/2021/2048.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,16 +17,16 @@

randomindex = -1
randomints = [
28, 9, 40, 74, 28, 56, 82, 61, 80, 95,
14, 97, 47, 83, 63, 88, 91, 39, 2, 85,
28, 9, 40, 74, 28, 56, 82, 61, 80, 95,
14, 97, 47, 83, 63, 88, 91, 39, 2, 85,
82, 61, 69, 35, 19, 17, 64, 21, 29, 20,
94, 59, 73, 50, 1, 69, 30, 39, 26, 11,
21, 94, 1, 24, 12, 8, 3, 90, 13, 8,
52, 48, 41, 86, 60, 33, 74, 83, 9, 48,
90, 12, 60, 44, 9, 58, 64, 61, 50, 74,
94, 59, 73, 50, 1, 69, 30, 39, 26, 11,
21, 94, 1, 24, 12, 8, 3, 90, 13, 8,
52, 48, 41, 86, 60, 33, 74, 83, 9, 48,
90, 12, 60, 44, 9, 58, 64, 61, 50, 74,
97, 77, 69, 81, 62, 18, 22, 64, 25, 61,
56, 63, 95, 39, 21, 6, 87, 98, 28, 52,
35, 69, 43, 92, 94, 88, 4, 39, 6, 20
56, 63, 95, 39, 21, 6, 87, 98, 28, 52,
35, 69, 43, 92, 94, 88, 4, 39, 6, 20
]


Expand All @@ -46,7 +46,7 @@ def randint(minimum, maximum):
global randomindex
randomindex = randomindex + 1
randomindex = randomindex % len(randomints)
rand_range = maximum-minimum
rand_range = maximum - minimum
# Trim to given Range
random = randomints[randomindex]
random = random % (rand_range + 1)
Expand Down Expand Up @@ -91,7 +91,7 @@ def printField(state):
for j in i:
feldzeile += str(j)
# Right Padding with space
for k in range(longestString-len(str(j))):
for k in range(longestString - len(str(j))):
feldzeile += " "
feldzeile += "|"
print(feldzeile)
Expand Down Expand Up @@ -150,7 +150,7 @@ def getNextMove():
print("bye")
exit()
else:
print("Expected one of: [w, a, s, d] but got "+move+".")
print("Expected one of: [w, a, s, d] but got " + move + ".")
return getNextMove()


Expand Down Expand Up @@ -259,7 +259,7 @@ def slideTiles(currentState, xMov, yMov):
"""
newState = currentState
forwardRange = range(len(currentState))
backwardRange = range(len(currentState)-1, -1, -1)
backwardRange = range(len(currentState) - 1, -1, -1)
# Durch Feld Iterieren
# Anmerkung: Hier muss man darauf achten, in welcher Reihenfolge man durch die Felder geht,
# da sonst mehrere Felder auf einmal addiert werden können
Expand All @@ -281,8 +281,8 @@ def slideTiles(currentState, xMov, yMov):
# Ansatz: wir gehen solange in die Schieberichtung,
# bis der nächste Schritt außerhalb des Feldes Läge oder wir auf ein nichtleeres Feld stoßen.
for i in range(4):
nextX = newX+xMov
nextY = newY+yMov
nextX = newX + xMov
nextY = newY + yMov
if not pointIsInGameField(len(currentState), nextX, nextY) or newState[nextY][nextX] != 0:
break
newX = nextX
Expand All @@ -296,8 +296,8 @@ def slideTiles(currentState, xMov, yMov):
# bis der nächste Schritt außerhalb des Feldes Läge oder wir auf ein nichtleeres Feld stoßen.
# Sollten wir auf ein nichtleeres Feld mit dem Gleichen Wert stoßen, haben wir eine Verschmelzposition gefunden.
for i in range(4):
prevX = newMergeX-xMov
prevY = newMergeY-yMov
prevX = newMergeX - xMov
prevY = newMergeY - yMov
if not pointIsInGameField(len(currentState), prevX, prevY):
break
if newState[prevY][prevX] != 0:
Expand All @@ -310,7 +310,7 @@ def slideTiles(currentState, xMov, yMov):
# Verschieben an neue Position, und ggf multiplizieren
newState[y][x] = 0
if (newState[newMergeY][newMergeX] != 0):
newState[newY][newX] = 2*field
newState[newY][newX] = 2 * field
newState[newMergeY][newMergeX] = 0
else:
newState[newY][newX] = field
Expand Down
3 changes: 2 additions & 1 deletion codingchallenges/2021/bewertungsleitfaden.tex
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

% Packages
\usepackage{hyperref}
\usepackage{darkmode}

%\usepackage{ClearSans}
\usepackage{csquotes}
Expand Down Expand Up @@ -90,7 +91,7 @@
boxrule=0pt,
left=5pt, % Links Platz lassen
enhanced, % Erlaubt uns, den ramen zu zeichnen
fonttitle=\sffamily, % Titelschriftart auf
fonttitle=\sffamily, % Titelschriftart auf
overlay={ % Für Grauen Bereich links
\begin{tcbclipinterior}%
\fill[TUDa-3c] (frame.south west) rectangle ([xshift=4pt]frame.north west); % Zeilennummernbereich färben
Expand Down
6 changes: 3 additions & 3 deletions codingchallenges/2021/vorstellung.tex
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
% !TeX root = vorstellung.tex
%\PassOptionsToClass{handout}{beamer}
\input{../../lecture/global}
\logo*{\includegraphics{../../lecture/globalMedia/bildmarke_ohne_rand}}
\logo*{\includegraphics{../../lecture/globalMedia/logo\IfDarkModeT{-dark}.pdf}}
% Packages
\usepackage{hyperref}

Expand Down Expand Up @@ -60,8 +61,7 @@
}


%\logo[2]{\includegraphics[scale=5]{../../lecture/globalMedia/bildmarke_ohne_rand}}

%\logo[2]{\includegraphics[scale=5]{../../lecture/globalMedia/logo\IfDarkModeT{-dark}.pdf}}


\begin{document}
Expand Down
Loading

0 comments on commit 38e9d12

Please sign in to comment.