This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| def fuelle(grenze, inhalt, gegenstaende, loesungen): | |
| if loesungen==0 or grenze==0: | |
| return 0 | |
| if (inhalt[loesungen-1] > grenze): | |
| return fuelle(grenze, inhalt, gegenstaende, (loesungen-1)) | |
| else: | |
| return max(gegenstaende[loesungen-1] + | |
| fuelle(grenze - inhalt[loesungen-1], inhalt, gegenstaende, loesungen-1), |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from tkinter import * | |
| from tkinter import messagebox | |
| import sys | |
| import time | |
| class KnightsTour: | |
| def __init__(self, xstart, ystart): | |
| self.board = [] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from Tkinter import* | |
| class DamenProblem: | |
| def __init__(self, groesse): | |
| self.liste=[] | |
| self.groesse = groesse | |
| self.loesungen = 0 | |
| self.loese() | |
| #self.printList() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from Tkinter import * | |
| class GUI: | |
| def __init__(self): | |
| self.root = Tk() | |
| self.root.geometry("900x1000") | |
| self.root.title("Knights Tour") | |
| self.root.configure(background="#353f4f") | |
| self.createWidgets() | |
| self.board.bind("<Motion>", func=self.displayHover) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class KnightsTour: | |
| def __init__(self, xstart, ystart): | |
| self.board = [] | |
| self.poss = [ | |
| (-2,-1), #1 | |
| (-2,1), #2 | |
| (-1, 2), #3 | |
| (1, 2), #4 | |
| (2, 1), #5 | |
| (2, -1), #6 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/python | |
| from nikos_welt import * | |
| class MeinRoboter(Roboter): | |
| def rechts(self): | |
| for i in range(0,3): | |
| self.links() | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| istdrinn::[Int]->Int->Bool | |
| istdrinn [] a = False | |
| istdrinn (x:xs) a | |
| |x==a=True | |
| |otherwise=istdrinn xs a | |
| sort::[Int]->Int->[Int] | |
| sort [] a = [a] | |
| sort (x:xs) a |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| reverseList :: [Int] -> [Int] | |
| reverseList [] = [] | |
| reverseList (x:xs) = reverseList xs ++ [x] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| insert :: Int -> [Int] -> [Int] | |
| insert x [] = [x] | |
| insert x (y:ys) = if x < y | |
| then x:y:ys | |
| else y : insert x ys | |
| insertionSort :: [Int] -> [Int] | |
| insertionSort [x] = [x] | |
| insertionSort (x:xs) = insert x (insertionSort xs) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| def quicksort(list, i, j): | |
| if i >= j: | |
| return | |
| pivot = list[j] | |
| left = i | |
| right = j - 1 | |
| while left <= right: | |
| while left <= right and list[left] <= pivot: | |
| left += 1 | |
| while left <= right and list[right] >= pivot: |