Skip to content

Commit

Permalink
Changes.
Browse files Browse the repository at this point in the history
  • Loading branch information
NeonScripter committed Jan 7, 2024
1 parent 87f2056 commit ac9425a
Show file tree
Hide file tree
Showing 11 changed files with 285 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@
public class GOLgoal extends CellularAutomataUi {

public GOLgoal(ICellularRules... cellularRules) {
super(cellularRules);
super("GOLgoal", cellularRules);
}

public static void main(String[] args) {
new GOLgoal(new golnormal (), new CWgolf(), new idk(), new checkrboards(), new newgol(), new votingforbiden(), new newvoting(), new gullibleseagull(), new anothervotingrulechange(), new lifeandwar(), new deadlywar()).start();
new GOLgoal(new golnormal (), new CWgolf(), new idk(), new checkrboards(), new newgol(), new votingforbiden(), new newvoting(), new gullibleseagull(), new anothervotingrulechange(), new lifeandwar(), new deadlywar(), new squarelace(), new hereatthayer()).start();
}

}
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;
}
}
}

}
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;
}
}
}

}
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 src/main/java/programming/school/student/dylan/SpinningLine.java
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);
});
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,7 @@ public class AroundTheWorldIn80Cities implements IAdventureGame {
Thing newyorkoceanrunner = new Thing("New York Ocean Runner", "An extremely strong boat!");

private final Creature artobserver = new Creature("art observer", "He's looking at a painting by Timmy the Toddler.");
private final Creature sheldon = new Creature("Sheldon", "That's one strike for breaking my examination rule.");

public AroundTheWorldIn80Cities() {

Expand Down Expand Up @@ -133,6 +134,7 @@ public AroundTheWorldIn80Cities() {
iqaluit.setPicture(getClass().getResource("iqaluit.jpg"));
quebeccity.setPicture(getClass().getResource("quebeccity.jpg"));
charleston.setPicture(getClass().getResource("charleston.jpg"));
rotterdam.setPicture(getClass().getResource("rotterdam.jpg"));

Store storeExtension = new Store();
Thing NORTHKOREATOURISM = new Thing ("North Korea Tourism Access","Go to North Korea and leave.");
Expand Down Expand Up @@ -449,7 +451,7 @@ public AroundTheWorldIn80Cities() {
no.addDirection("LAST WAAAAAR#####NINNNNGGGGG", territoryoflostsouls);
startingPlace.addDirection("Washington DC Museum", Washingtonmuseum);
Washingtonmuseum.addDirection("back", startingPlace);
newyork.addDirection("Port of New York", portofnewyork);
newyork.addDirection("nyc port", portofnewyork);
portofnewyork.addDirection("back", newyork);
portofnewyork.addDirection("view port schedules", newyorkportschedules);
newyorkportschedules.addDirection("back", portofnewyork);
Expand All @@ -464,7 +466,7 @@ public AroundTheWorldIn80Cities() {
portofnewyork.addDirection("NY-LA ferry", portoflosangeles);
portoflosangeles.addDirection("back", losangeles);
portoflosangeles.addDirection("LA-NY ferry", portofnewyork);
losangeles.addDirection("Port of Los Angeles", portoflosangeles);
losangeles.addDirection("la port", portoflosangeles);
newyorkdock.addDirection("voyage to rotterdam", northatlantic);
newyorkdock.addDirection("cancel voyage", portofnewyork);
northatlantic.addDirection("keep going!!", rotterdamdock);
Expand All @@ -483,6 +485,7 @@ public AroundTheWorldIn80Cities() {
arthallwashington.addDirection("back", Washingtonmuseum);

arthallwashington.addCreature(artobserver);
losangeles.addCreature(sheldon);

MiamiSpeeder.setProperty("LVL2BOAT", "true");
}
Expand Down
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 src/main/java/programming/school/student/dylan/dyunminraft.java
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 src/main/java/programming/school/student/dylan/goodgame.java
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 src/main/java/programming/school/student/dylan/sommath.java
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 src/main/java/programming/school/student/timotej/Drigonometry.java
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);
}

}

0 comments on commit ac9425a

Please sign in to comment.