Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions src/pegthing/core.clj
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
(ns pegthing.core
(require [clojure.set :as set])
(:require [clojure.set :as set])
(:gen-class))

(declare successful-move prompt-move game-over prompt-rows)
Expand Down Expand Up @@ -217,10 +217,10 @@
(println "Move from where to where? Enter two letters:")
(let [input (map letter->pos (characters-as-strings (get-input)))]
(if-let [new-board (make-move board (first input) (second input))]
(successful-move new-board)
#(successful-move new-board)
(do
(println "\n!!! That was an invalid move :(\n")
(prompt-move board)))))
#(prompt-move board)))))

(defn successful-move
[board]
Expand Down Expand Up @@ -253,9 +253,9 @@
(println "How many rows? [5]")
(let [rows (Integer. (get-input 5))
board (new-board rows)]
(prompt-empty-peg board)))
#(prompt-empty-peg board)))

(defn -main
[& args]
(println "Get ready to play peg thing!")
(prompt-rows))
(trampoline prompt-rows))