Skip to content

Instantly share code, notes, and snippets.

View sumtyme's full-sized avatar

Carl Summers sumtyme

  • Lockheed Martin
  • Colorado Springs, Co.
View GitHub Profile
@sumtyme
sumtyme / SeedEarth.java
Last active December 15, 2015 14:39 — forked from anonymous/gist:5274745
public void seedEarth(int coord1, int coord2, int probStat, int probDec) {
if(coord1 < gridSize && coord2 < gridSize && coord1 >= 0 && coord2 >= 0) {
if(grid[coord1][coord2]!= 1){
grid[coord1][coord2] = 1;
if(randomGen.nextInt(100) <= 100 - probStat) {
seedEarth(coord1 -1,coord2, probStat + probDec, probDec);
}
if(randomGen.nextInt(100) <= 100 - probStat) {
seedEarth(coord1, coord2-1, probStat + probDec, probDec);
}
@sumtyme
sumtyme / Test.java
Last active December 11, 2015 16:48
An Highlighting example
package test;
import java.awt.Color;
import java.awt.Dimension;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.util.Random;
import javax.swing.JButton;
import javax.swing.JComponent;
@sumtyme
sumtyme / LineInfo.java
Created November 20, 2012 03:46 — forked from anonymous/LineInfo.java
LineInfo help!
/**
* LineInfo class
*
* @author sinister
*
*/
public class LineInfo {
private String myLine;
@sumtyme
sumtyme / TEST
Created November 13, 2012 19:58
TEST
TEST
@sumtyme
sumtyme / GuiChooser.java
Created November 2, 2012 21:33
"Real" code - Weka
/*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
@sumtyme
sumtyme / Assignment2
Created October 18, 2012 17:38
Assignment2
public class Assignment2 {
private BufferedReader reader;
private String str;
public static void main(String[] args) {
Assignment2 program = new Assignment2();
}// main
public Assignment2() throws Exception {
@sumtyme
sumtyme / Test.s
Created August 15, 2012 22:22
Just in case you were too lazy to do it:
.file "test.c"
.text
.p2align 4,,15
.globl swap1
.type swap1, @function
swap1:
.LFB11:
.cfi_startproc
movl (%rsi), %eax
xorl (%rdi), %eax
import java.awt.Color;
import java.awt.Dimension;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.Rectangle;
import java.awt.geom.Ellipse2D;
import java.awt.geom.Path2D;
import javax.swing.JFrame;
import javax.swing.JPanel;
public abstract class BackedVirtualMemory extends SimpleVirtualMemory {
protected int currentPageIndex = 0;
protected int pageSize;
protected int maxPages;
public BackedVirtualMemory(){
this(100, 10);
}
class ExtremaTests {
// maxArray()
// returns the largest value in int array A
static int maxArray(int[] A, int start, int end) {
if (start < end) {
int middle = (start + end) / 2;
maxArray(A, start, middle);
maxArray(A, middle + 1, end);
return Math.max(maxArray(A, start, middle), maxArray(A, middle + 1, end));
}else{