Skip to content

Instantly share code, notes, and snippets.

View jameslzhu's full-sized avatar

James Zhu jameslzhu

View GitHub Profile
@jameslzhu
jameslzhu / galaxy.py
Last active January 22, 2020 18:09
Galaxy collision simulator, written with VPython.
#!/usr/bin/env python2
#
# galaxy - jzhu98
# See bottom for LICENSE.
#
from __future__ import division
from math import fsum
from random import gauss
@jameslzhu
jameslzhu / blackjack.js
Created December 21, 2013 04:26
A simple JavaScript blackjack game, coded as part of a Codecademy course. The player can "hit" and be dealt another card, or "stop". The player plays against a computer opponent. Highest hand 21 and under wins.
function Card(s, n) {
var suit = s;
var number = n;
this.getNumber = function() {
return number;
};
this.getSuit = function() {
return suit;
};
this.getValue = function() {
@jameslzhu
jameslzhu / voxel_circle.cpp
Created November 17, 2013 21:17
Outputs a pixelated circle to the console. Useful for graphics or Minecraft.
#include <iostream>
#include <vector>
#include <array>
typedef std::array<float, 2> xyCoord;
float isInCircle(float x, float y, float radius);
void setSquareCoords(int row, int column, std::array<xyCoord, 4>& square);
int main()