flyingmachine / pegthing Goto Github PK
View Code? Open in Web Editor NEWLicense: Eclipse Public License 1.0
License: Eclipse Public License 1.0
Here is how it goes in the repl:
Get ready to play peg thing!
How many rows? [5]
7
Here's your board:
a0
b0 c0
d0 e0 f0
g0 h0 i0 j0
k0 l0 m0 n0 o0
p0 q0 r0 s0 t0 u0
IndexOutOfBoundsException clojure.lang.RT.nthFrom (RT.java:795)
I believe this is because you're using require
not :require
, not that the code is even necessary anymore with set being built into clojure.core.
I've been following along with the book Clojure for the Brave and True and I've noticed a few issues. In the book examples, (require)
is used, when it should be (:require)
.
Additionally, some of the functions are referred to in the book, but their code is not shown in the book itself (e.g. colorize, strings-as-characters, etc.) Perhaps the tutorial is meant to go along with the code repo (which does work), but I was trying to build it from scratch using only the examples in the book and I couldn't get it to compile without downloading this repo and changing certain things and copying over the missing functions.
In project.clj
I updated :dependencies [[org.clojure/clojure "1.10.1"]]
. Furthermore I add to change
(ns pegthing.core
(:gen-class))
since set is loaded with clojure.core now.
There is a bug here:
https://github.com/flyingmachine/pegthing/blob/master/src/pegthing/core.clj#L98-L100
Should be:
(defn valid-moves
"Return a map of all valid moves for pos, where the key is the
destination and the value is the jumped position"
[board pos]
(into {}
(filter (fn [[destination jumped]]
(and (not (pegged? board destination))
(pegged? board jumped)
(pegged? board pos)))
(get-in board [pos :connections]))))
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.