Skip to content

Instantly share code, notes, and snippets.

@Unix-Code
Unix-Code / Black Jack
Last active September 9, 2015 13:36
Unfinished
import java.util.*;
public class BlackJack {
private ArrayList<Card> hand1 = new ArrayList<Card>();
private ArrayList<Card> hand2 = new ArrayList<Card>();
private ArrayList<Card> hand3 = new ArrayList<Card>();
Scanner Scan = new Scanner(System.in);
public void start() {
deal();
System.out.print("\f");
@Unix-Code
Unix-Code / Character
Last active September 12, 2015 01:31
DnD Character
import java.io.*;
public class Character {
private String charName;
private String charRace;
private String gender;
private int age;
private String charClass;
private int strength;
private int constitution;
private int dexterity;
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import java.util.*;
public class SwingJPanelDemo extends Frame implements ActionListener {
private JLabel labelUsername = new JLabel("Enter username: ");
private JLabel labelPassword = new JLabel("Enter password: ");
private JTextField textUsername = new JTextField(20);
@Unix-Code
Unix-Code / MovingObj
Last active November 8, 2015 21:28
Game
class MovingObj extends Object {
int xSpeed, ySpeed;
MovingObj() {
super();
xSpeed = 1;
ySpeed = 1;
}
MovingObj(float inX, float inY, float inW, float inH, float inXSpeed, float inYSpeed) {
super(inX, inY, inW, inH)
@Unix-Code
Unix-Code / BasetoBaseConverter.java
Last active October 29, 2015 02:18
Convert between bases 2 - 36. (Work in Progress)
import java.util.*;
public class BasetoBaseConverter {
public static void main(String[] args) {
Scanner Scan = new Scanner(System.in);
BasetoBaseConverter Run = new BasetoBaseConverter();
System.out.println("\fWhat number would you like to convert?");
String input = Scan.nextLine();
String start = input;
@Unix-Code
Unix-Code / NewtonMethod.java
Last active November 10, 2015 17:01
[W.I.P] Polynomial Calculator
public class NewtonMethod {
public static void main(String[] args) {
NewtonMethod test = new NewtonMethod();
test.calc("4x^3 + 7x^2 + 5x + 6", -2, 5);
}
public void calc(String polynomial, double firstGuess, int tolerance) {
Polynomial p = new Polynomial(polynomial);
double newGuess;
double oldGuess = firstGuess;
@Unix-Code
Unix-Code / Location.java
Created November 10, 2015 14:48
In Class Location and Map
public class Location {
private double x;
private double y;
public Location() {
x = 0.0;
y = 0.0;
}
public Location(double x, double y) {
public class NonConsecArray {
public int sum(int[] array) {
int Sum = 0;
int i = 0;
if (array.length%2 != 0) {
int iTemp = 2;
int tempSum = 0;
while (i < array.length) {
if (i + iTemp >= array.length - 1) {
iTemp++;
import java.util.Date;
import java.util.Random;
public class ArrayRepetitionFinder {
public static void main(String[] args) {
//int[] array = new int[100000000];
Random rand = new Random();
long[] times = new long[10];
/*for (int i = 0; i < array.length; i++) {
array[i] = rand.nextInt(9) + 1;
}*/
import java.util.Date;
public class Encryptor {
public static void main(String[] args) {
String check = "";
for (int i = 0; i < 100000; i++) {
check += (char)(Math.random()*27 + 'a');
}
Date start = new Date();