-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
87f2056
commit ac9425a
Showing
11 changed files
with
285 additions
and
4 deletions.
There are no files selected for viewing
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
47 changes: 47 additions & 0 deletions
47
src/main/java/programming/school/student/dylan/GOLgoal/hereatthayer.java
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
package programming.school.student.dylan.GOLgoal; | ||
|
||
import programming.school.cell.ICellularRules; | ||
|
||
public class hereatthayer implements ICellularRules { | ||
|
||
@Override | ||
public String name() { | ||
return "Here At Thayer"; | ||
} | ||
|
||
@Override | ||
public int width() { | ||
return 100; | ||
} | ||
|
||
@Override | ||
public int height() { | ||
return 100; | ||
} | ||
|
||
@Override | ||
public int initialValue(int x, int y) { | ||
return 0; | ||
} | ||
|
||
@Override | ||
public int newState(int oldState, int[] neigbors) { | ||
int c = 0; | ||
for ( int i: neigbors ) { | ||
if ( i == 1 ) c++; | ||
} | ||
if ( oldState == 0 ) { | ||
if ( c == 5 ) return 1; | ||
else return 0; | ||
} else { | ||
if ( c < 2 ) { | ||
return 0; | ||
} else if ( c > 3 ) { | ||
return 0; | ||
} else { | ||
return 1; | ||
} | ||
} | ||
} | ||
|
||
} |
47 changes: 47 additions & 0 deletions
47
src/main/java/programming/school/student/dylan/GOLgoal/squarelace.java
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
package programming.school.student.dylan.GOLgoal; | ||
|
||
import programming.school.cell.ICellularRules; | ||
|
||
public class squarelace implements ICellularRules { | ||
|
||
@Override | ||
public String name() { | ||
return "Square Lace"; | ||
} | ||
|
||
@Override | ||
public int width() { | ||
return 100; | ||
} | ||
|
||
@Override | ||
public int height() { | ||
return 100; | ||
} | ||
|
||
@Override | ||
public int initialValue(int x, int y) { | ||
return 0; | ||
} | ||
|
||
@Override | ||
public int newState(int oldState, int[] neigbors) { | ||
int c = 0; | ||
for ( int i: neigbors ) { | ||
if ( i == 1 ) c++; | ||
} | ||
if ( oldState == 0 ) { | ||
if ( c == 1 ) return 1; | ||
else return 0; | ||
} else { | ||
if ( c < 2 ) { | ||
return 0; | ||
} else if ( c > 3 ) { | ||
return 0; | ||
} else { | ||
return 1; | ||
} | ||
} | ||
} | ||
|
||
} |
36 changes: 36 additions & 0 deletions
36
src/main/java/programming/school/student/dylan/LessonCoordinates.java
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
/* | ||
* What is this? | ||
*/ | ||
package programming.school.student.dylan; | ||
|
||
import programming.school.framework.CoordinateSystem; | ||
import programming.school.framework.IMathPlotter; | ||
|
||
public class LessonCoordinates implements IMathPlotter { | ||
|
||
@Override | ||
public int maxX() { | ||
return 500; | ||
} | ||
|
||
@Override | ||
public int maxY() { | ||
return 500; | ||
} | ||
|
||
@Override | ||
public String windowTitle() { | ||
return "Simple plot"; | ||
} | ||
|
||
@Override | ||
public void plot(CoordinateSystem cs) { | ||
cs.line(0.0, 0.0, 0.5, 0.5); | ||
cs.dot(0.25, 0.25); | ||
} | ||
|
||
public static void main(String[] args) { | ||
new CoordinateSystem(new LessonCoordinates()).runContainer(); | ||
} | ||
|
||
} |
64 changes: 64 additions & 0 deletions
64
src/main/java/programming/school/student/dylan/SpinningLine.java
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
package programming.school.student.dylan; | ||
import javax.swing.*; | ||
import java.awt.*; | ||
import java.awt.geom.*; | ||
|
||
public class SpinningLine extends JPanel { | ||
|
||
private double angle = 0; | ||
private Color lineColor = Color.RED; | ||
|
||
public void animate() { | ||
Timer timer = new Timer(10, e -> { | ||
angle += 0.01; // Increment angle for rotation | ||
lineColor = generateRandomColor(); // Generate a random color | ||
|
||
repaint(); // Refresh the panel | ||
}); | ||
timer.start(); | ||
} | ||
|
||
private Color generateRandomColor() { | ||
// Generate random RGB values between 0 and 255 | ||
int red = (int) (Math.random() * 256); | ||
int green = (int) (Math.random() * 256); | ||
int blue = (int) (Math.random() * 256); | ||
|
||
return new Color(red, green, blue); | ||
} | ||
|
||
@Override | ||
protected void paintComponent(Graphics g) { | ||
super.paintComponent(g); | ||
|
||
Graphics2D g2d = (Graphics2D) g; | ||
int centerX = getWidth() / 2; | ||
int centerY = getHeight() / 2; | ||
int radius = Math.min(centerX, centerY) - 50; | ||
|
||
g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); | ||
g2d.setStroke(new BasicStroke(5)); | ||
g2d.setColor(lineColor); | ||
|
||
double x = centerX + radius * Math.cos(angle); | ||
double y = centerY + radius * Math.sin(angle); | ||
|
||
g2d.draw(new Line2D.Double(centerX, centerY, x, y)); | ||
} | ||
|
||
public static void main(String[] args) { | ||
SwingUtilities.invokeLater(() -> { | ||
JFrame frame = new JFrame("Spinning Line"); | ||
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); | ||
|
||
SpinningLine spinningLine = new SpinningLine(); | ||
spinningLine.setPreferredSize(new Dimension(500, 500)); | ||
spinningLine.animate(); | ||
|
||
frame.getContentPane().add(spinningLine); | ||
frame.pack(); | ||
frame.setLocationRelativeTo(null); | ||
frame.setVisible(true); | ||
}); | ||
} | ||
} |
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
Binary file added
BIN
+175 KB
src/main/java/programming/school/student/dylan/aroundtheworld/rotterdam.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
23 changes: 23 additions & 0 deletions
23
src/main/java/programming/school/student/dylan/dyunminraft.java
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
//dwihdo | ||
package programming.school.student.dylan; | ||
|
||
import java.awt.Color; | ||
import java.awt.Graphics2D; | ||
|
||
import programming.school.framework.DrawingContainer; | ||
import programming.school.framework.IDrawingInstructions; | ||
|
||
public class dyunminraft implements IDrawingInstructions { | ||
|
||
@Override | ||
public void draw(Graphics2D g) { | ||
g.setColor(Color.BLUE); | ||
g.drawLine(0, 0, 1000, 1000); | ||
g.drawOval(100, 100, 100, 100); | ||
} | ||
|
||
public static void main(String[] args) { | ||
new DrawingContainer(new dyunminraft()).runContainer(args); | ||
} | ||
|
||
} |
19 changes: 19 additions & 0 deletions
19
src/main/java/programming/school/student/dylan/goodgame.java
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
package programming.school.student.dylan; | ||
import javax.swing.*; | ||
|
||
public class goodgame { | ||
|
||
public static void main(String[] args) { | ||
SwingUtilities.invokeLater(() -> { | ||
JFrame frame = new JFrame("goodgame"); | ||
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); | ||
|
||
JOptionPane.showMessageDialog(frame, | ||
"This program contains viral code that will delete files on your desktop. VirusX has shut it down to protect your computer.", | ||
"", | ||
JOptionPane.WARNING_MESSAGE); | ||
|
||
frame.dispose(); | ||
}); | ||
} | ||
} |
21 changes: 21 additions & 0 deletions
21
src/main/java/programming/school/student/dylan/sommath.java
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
package programming.school.student.dylan; | ||
|
||
public class sommath{ | ||
|
||
private static double radToDegrees(double rad) { | ||
return (180.0 * rad / Math.PI); | ||
} | ||
|
||
private static double degreeToRad(double degree) { | ||
return (Math.PI * degree / 180.0); | ||
} | ||
|
||
public static void main(String[]args) { | ||
double x; | ||
|
||
for (x = 0.0; x <= 360.0; x += 1.0) { | ||
System.out.println("sin(" + x + ") = " + Math.sin(degreeToRad(x))); | ||
System.out.println("cos(" + x + ") = " + Math.cos(degreeToRad(x))); | ||
} | ||
} | ||
} |
21 changes: 21 additions & 0 deletions
21
src/main/java/programming/school/student/timotej/Drigonometry.java
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
package programming.school.student.timotej; | ||
|
||
import java.awt.Color; | ||
import java.awt.Graphics2D; | ||
|
||
import programming.school.framework.DrawingContainer; | ||
import programming.school.framework.IDrawingInstructions; | ||
|
||
public class Drigonometry implements IDrawingInstructions { | ||
|
||
@Override | ||
public void draw(Graphics2D g) { | ||
g.setColor(Color.BLUE); | ||
g.drawLine(0, 0, 1000, 1000); | ||
} | ||
|
||
public static void main(String[] args) { | ||
new DrawingContainer(new Drigonometry()).runContainer(args); | ||
} | ||
|
||
} |