Skip to content

Instantly share code, notes, and snippets.

View alexanderbazo's full-sized avatar
🧰
Crafting Solutions for Digital Transformation

Alexander Bazo alexanderbazo

🧰
Crafting Solutions for Digital Transformation
View GitHub Profile
@alexanderbazo
alexanderbazo / AntColony.java
Last active December 8, 2017 14:17
Ein Lösungsvorschlag für die AntColony
import de.ur.mi.graphicsapp.GraphicsApp;
import simulator.ColonySimulator;
import world.ColonyView;
public class AntColony extends GraphicsApp {
private static final int WIDTH = 300;
private static final int HEIGHT = 300;
private ColonySimulator simulator;
private ColonyView view;
@alexanderbazo
alexanderbazo / canvas.js
Created December 6, 2016 08:45
Zeichnen auf dem HTML5-Canvas
var canvas = document.querySelector("#canvas"),
context = canvas.getContext("2d");
// Zeichne eine Linie von x1,y1 nach x2,y2
function drawLine(x1, y1, x2, y2, color, weight) {
context.beginPath();
context.moveTo(x1, y1);
context.lineTo(x2, y2);
context.strokeStyle = color;
context.lineWidth = weight;
Compound board = new Compound()
private void initBoard(int fieldWidth, int fieldHeight) {
board = new Compound(0, 0);
for (int x = 0; x < ROWS; x++) {
for (int y = 0; y < COLUMNS; y++) {
Chessfield newField = getNewFieldForBoard(x, y, fieldWidth,fieldHeight);
board.add(newField);
}
}
@alexanderbazo
alexanderbazo / grid.java
Last active January 8, 2016 07:44
Grid-Erstellung in der Graphics-App
private void setupGrid() {
rows = (int) Math.sqrt(NUM_SQUARES);
columns = (int) Math.sqrt(NUM_SQUARES);
squareHeight = HEIGHT / rows;
squareWidth = WIDTH / columns;
}
private void drawGrid() {
for (int x = 0; x < rows; x++) {
for (int y = 0; y < columns; y++) {