From 048e964468687035049e1928f7a2cc9f4189b116 Mon Sep 17 00:00:00 2001 From: Henrikh Kantuni Date: Mon, 20 Apr 2020 23:24:32 +0400 Subject: [PATCH] Update functional-programming.html --- content/cftbat/functional-programming.html | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/content/cftbat/functional-programming.html b/content/cftbat/functional-programming.html index 19db1dd6..0acfb36a 100644 --- a/content/cftbat/functional-programming.html +++ b/content/cftbat/functional-programming.html @@ -353,10 +353,10 @@

Code Organization

(require [clojure.set :as set]) (:gen-class)) -(declare successful-move prompt-move game-over query-rows) +(declare successful-move prompt-move game-over prompt-rows) -

I’ll explain the functions here in more detail in Chapter 6. If you’re curious about what’s going on, the short explanation is that (require [clojure.set :as set]) allows you to easily use functions in the clojure.set namespace, (:gen-class) allows you to run the program from the command line, and (declare successful-move prompt-move game-over query-rows) allows functions to refer to those names before they’re defined. If that doesn’t quite make sense yet, trust that I will explain it soon.

+

I’ll explain the functions here in more detail in Chapter 6. If you’re curious about what’s going on, the short explanation is that (require [clojure.set :as set]) allows you to easily use functions in the clojure.set namespace, (:gen-class) allows you to run the program from the command line, and (declare successful-move prompt-move game-over prompt-rows) allows functions to refer to those names before they’re defined. If that doesn’t quite make sense yet, trust that I will explain it soon.

Creating the Board

The data structure you use to represent the board should make it easy for you to print the board, check whether a player has made a valid move, actually perform a move, and check whether the game is over. You could structure the board in many ways to allow these tasks. In this case, you’ll represent the board using a map with numerical keys corresponding to each board position and values containing information about that position’s connections. The map will also contain a :rows key, storing the total number of rows. Figure 5-3 shows a board with each position numbered.