This file contains 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
//Autor: Nadja Krümmel | |
class BinaryDigit { | |
int[] binary; | |
int decimal; | |
BinaryDigit() { | |
this.binary = new int[4]; | |
this.binary[3] =0; | |
this.decimal = 0; | |
} |
This file contains 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
//Autor: Christopher Schölzel | |
float FRONT_WIDTH = 20; | |
class Snowflake { | |
float noiseX; | |
float noiseY; | |
float x,y; | |
float vx,vy; | |
float w; | |
Snowflake(float x, float y, float vx, float vy, float w) { |
This file contains 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
//Autor: Christopher Schölzel | |
float angle = 0; | |
void setup() { | |
size(400,400); | |
} | |
void draw() { | |
background(255); |
This file contains 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
//Autor: Christopher Schölzel | |
// ------------------------------------------- | |
// -- Musterlösungen zu Fibonacci-Varianten -- | |
// ------------------------------------------- | |
int fib(int n) { | |
if (n <= 1) return n; | |
else return fib(n-2)+fib(n-1); | |
} |
This file contains 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
//Autor: Christopher Schölzel, Nadja Krümmel | |
int TYPE_EMPTY = 0; | |
int TYPE_BLUE = 1; | |
int TYPE_RED = -1; | |
class ConnectFour { | |
float brickWidth = 50; | |
float margin = 50; | |
int[][] field; | |
// 0 = leer, +1 = blau, -1 = rot | |
ConnectFour(int cols, int rows) { |
This file contains 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
//Autor: Christopher Schölzel | |
class Square { | |
boolean negotiable; //begehbar oder nicht? | |
boolean isExit; | |
Square(boolean negotiable, boolean isExit) { | |
this.negotiable = negotiable; | |
this.isExit = isExit; | |
} | |
boolean isExit() { |
This file contains 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
//Autor: Christopher Schölzel | |
class Field { | |
int[][] content; | |
float fh,fw; | |
float px,py; | |
Field(float posX, float posY, int fieldsX, int fieldsY, float fieldWidth, float fieldHeight) { | |
content = new int[fieldsY][fieldsX]; | |
this.fw = fieldWidth; | |
this.fh = fieldHeight; |
This file contains 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
//Autor: Christopher Schölzel | |
//Abstrakte Superklasse für Bird und Balloon | |
//Vermeidet, dass z.b. visible doppelt implementiert werden muss | |
abstract class Movable { | |
float w,h; | |
float x,y; | |
Movable(float w, float h, float x, float y) { | |
this.w = w; | |
this.h = h; |
This file contains 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
//Autor: Christopher Schölzel | |
class Bar { | |
int value; | |
boolean marked; | |
Bar(int value) { | |
this.value = value; | |
marked = false; | |
} | |
//Zeichnet den balken an position (x,y) mit der Breite b und | |
//dem Streckungsfaktor hFac für die Balkenhöhe. |
This file contains 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
//Autor: Christopher Schölzel | |
//Klasse für die Kanonenkugel | |
class CannonBall { | |
float x,y; //Position der Kugel | |
float vx,vy; //Geschwindigkeit auf der x- bzw. y-Achse | |
float d; //Durchmesser der Kugel | |
float dragCoefficient = 0.001; //Luftwiderstand | |
Environment env; | |
CannonBall(float x, float y, float vx, float vy, float d, Environment env) { |
NewerOlder