Skip to content

Instantly share code, notes, and snippets.

View GeoffPurdy's full-sized avatar

Geoffrey Purdy GeoffPurdy

View GitHub Profile

Keybase proof

I hereby claim:

  • I am GeoffPurdy on github.
  • I am geoffpurdy (https://keybase.io/geoffpurdy) on keybase.
  • I have a public key whose fingerprint is 8A57 834E F618 5E66 576A 49F2 CB0A E882 875B D392

To claim this, I am signing this object:

class Game
def initialize
@ranks = (0x1..0xE).to_a # 0x2 = 2 .. 0xE = Ace
@deck = []
@hands = [[],[]]
@active = rand(0..1) # stores which player is active
def turn
return @active%2
end
class Game
def initialize
@TARGET = 15
@numbers = (1..9).to_a
@scores = [0,0]
@turn = [0,1].sample # randomly decide who goes first
return self
end
def run
class Currency
def initialize(denominations) # denominatons of currency passed as hash
@denominations = denominations
end
def make_change(amount)
# determine change as minimim possible coinage
@amount = (amount * 100).to_i # convert $ to ¢ //FIXME breaks abstraction
@change = {}
for key in @denominations.keys.sort.reverse # keys MUST to be in desc order
MIN=1
MAX=100
MAX_ATTEMPTS=5
won = false
guesses = []
secret = rand(MIN..MAX)
puts "Guess a number between " + MIN.to_s + " and " + MAX.to_s + ":"
begin
#My understanding of the game of blackjack is tenuous at best
#And I do not expect to master Blackjack before class tomorrow.
#Thus I will err on the side of simplicity at the risk of oversimplification
Required items:
One to eight decks of playing cards
Two or more Participants
One dealer
One or more non-dealer players (with implicit limit on number of players?)
Value for betting

#My understanding of the game of blackjack is tenuous at best #And I do not expect to master Blackjack before class tomorrow. #Thus I will err on the side of simplicity at the risk of oversimplification

Required items: One to eight decks of playing cards One dealer Two or more non-dealer players (with implicit limit on num players?)

@GeoffPurdy
GeoffPurdy / test.clj
Created January 18, 2014 17:23 — forked from adambard/test.clj
; Comments start with semicolons.
; Clojure is written in "forms", which are just
; lists of things inside parentheses, separated by whitespace.
;
; The clojure reader assumes that the first thing is a
; function or macro to call, and the rest are arguments.
;
; Here's a function that sets the current namespace:
(ns test)