Skip to content

Instantly share code, notes, and snippets.


Dan Pelensky pelensky

View GitHub Profile

Keybase proof

I hereby claim:

  • I am pelensky on github.
  • I am pelensky ( on keybase.
  • I have a public key ASAFyvEoyVgoewByUAdPqSca5BlRi00zTZHBQTmmJ7UdEAo

To claim this, I am signing this object:

pelensky / app-runner.clj
Created Aug 11, 2017
App Runner namespace, with parts of the code I haven't changed removed.
View app-runner.clj
(:require clj-http.client :as client]))
; Code removed
(defn- api-call [board-state]
(let [result (client/post "" {:form-params {"boardState" (str board-state)} :content-type :json} )]
(read-string (get result :body))))
(defn- player-move [board-state player]
pelensky / computer.clj
Last active Aug 11, 2017
All functions required for Network Computer Player Lambda
View computer.clj
(ns computer
:methods [[handler [networkplayer.BoardObject] Long]]) )
(declare negamax)
(def starting-depth 0)
(def starting-colour 1)
; Code removed
pelensky /
Created Aug 11, 2017
Board Object class with a getter and a setter to get JSON into Clojure
package networkplayer;
public class BoardObject {
private String boardState;
public void setBoardState(String boardState) {
this.boardState = boardState;
pelensky / life.clj
Last active Aug 1, 2017
Game Of Life Logic for an Infinite World in Clojure
View life.clj
(def fewest-neighbours-to-stay-living 2)
(def most-neighbours-to-stay-living 3)
(def exact-neighbours-to-regenerate 3)
(def neighbours
[ [-1 1] [0 1] [1 1]
[-1 0] [1 0]
[-1 -1] [0 -1] [1 -1]])
pelensky / display.clj
Created Aug 1, 2017
Game Of Life Display for an Infinite World in Clojure
View display.clj
(ns game-of-life.display)
(defn- current-x [coordinates]
(get (first coordinates) 0))
(defn- current-y [coordinates]
(get (first coordinates) 1))
(defn- remaining [coordinates]
into [] (rest coordinates))
pelensky / unbeatable_computer.clj
Created Jul 28, 2017
Negamax in Clojure - no Alpha Beta pruning
View unbeatable_computer.clj
(ns tic-tac-toe.unbeatable-computer
(:require [tic-tac-toe.board :as ttt-board]))
(declare negamax)
(def starting-depth 0)
(def starting-colour 1)
(defn find-computer-marker [board-state]
(if ( #(even? (count %)) (get board-state :board))
"X" "O"))