Created
May 27, 2012 01:18
-
-
Save splinterofchaos/2795801 to your computer and use it in GitHub Desktop.
A test taker for a test that tries whether you think concretely or abstractly, randomly or sequentialy.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /usr/bin/clisp | |
;;; A tester for http://www.thelearningweb.net/personalthink.html | |
;; It tests you thinking style in terms of concrete or abstract, | |
;; random or sequencial. If you plug your answers into this test, | |
;; (run with no arguments) it will generate a file, results.dat. | |
;; You can create a gnuplot graph with that by running | |
;; "gnuplot -persist plot.gnu". | |
(defun args() | |
(or #+SBCL *posix-argv* | |
#+CLISP *args* | |
nil)) | |
; This map described the answer key. | |
(defconstant *answers* '((c d a b) | |
(a c b d) | |
(b a d c) | |
(b c a d) | |
(a c b d) | |
(b c a d) | |
(b d c a) | |
(c a b d) | |
(d a b c) | |
(a c b d) | |
(d b c a) | |
(c d a b) | |
(b d c a) | |
(a c d b) | |
(a c b d))) | |
(defun produce.dat(csar) | |
"Produce results.dat for gnuplot. | |
csar should be a list in the form (CS AS AR CR)." | |
;; First, write the data for gnuplot. | |
;; From the axis, the points are up, left, down right. | |
(let ((cs (* 4 (first csar))) | |
(as (* 4 (second csar))) | |
(ar (* 4 (third csar))) | |
(cr (* 4 (fourth csar)))) | |
(with-open-file (gp "results.dat" | |
:direction :output | |
:if-does-not-exist :create) | |
(format gp " 0 ~d ~% ~ | |
~d 0 ~% ~ | |
0 -~d ~% ~ | |
-~d 0 ~% ~ | |
0 ~d ~%" cs as ar cr cs)))) | |
(defun answern(c row) | |
"The column of an answer. | |
Given an answer, c, and the row number it pertains to, | |
returns what column it finds c in." | |
(let ((symbol (cond ((char-equal c #\a) 'a) ((char-equal c #\b) 'b) | |
((char-equal c #\c) 'c) ((char-equal c #\d) 'd) | |
(t 'x))) | |
(row (nth row *answers*))) | |
(find-answer symbol row))) | |
(defun find-answer(symbol answers) | |
"Recursive helper of answern." | |
(if (consp answers) | |
(if (eq symbol (first answers)) | |
(- 3 (length (rest answers))) | |
(find-answer symbol (rest answers))) | |
-1)) | |
(defun answerp(c) (and (char-not-lessp c #\a) (char-not-greaterp c #\d))) | |
(defun fill-in-answers() | |
"Fills in the answers to the test via input. | |
Produces a list: (CS AS AR CR) which can be passed into produce.dat." | |
(let ((casr '(0 0 0 0))) | |
(format t "Please enter in your answers in pairs like so: AB or DC.~%") | |
(loop for n from 0 to 14 do | |
(format t "Question ~D: " (1+ n)) | |
(let ((ans (read-line))) | |
(if (and (= 2 (length ans)) | |
(answerp (char ans 0)) | |
(answerp (char ans 1)) | |
(char/= (char ans 0) (char ans 1))) | |
(progn | |
(incf (nth (answern (char ans 0) n) casr)) | |
(incf (nth (answern (char ans 1) n) casr))) | |
(progn | |
(format t "Incorrect format. Must be in a pair like BC or DA. Try again.~%") | |
(decf n))))) ; Redo this iteration | |
(format t "CS: ~D ~%AS: ~D~%AR: ~D~%CR: ~D~%" (first casr) (second casr) | |
(third casr) (fourth casr)) | |
casr)) | |
(format t "To take this test, please visit http://www.thelearningweb.net/personalthink.html ~%") | |
(format t "Read the questions from there and fill in the answers here.~%") | |
(let ((args (args))) | |
(cond ((= 4 (length args)) | |
(produce.dat (mapcar #'(lambda(s)(read-from-string s)) args))) | |
((= 0 (length args)) | |
(produce.dat (fill-in-answers))) | |
(t | |
(error "Incorrect number of arguments. 0 to take the test, 4 to produce results.dat")))) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
unset key | |
set object 1 rect from -70,2 to 70,-2 back | |
set object 1 rect fc rgb "#880055" fillstyle solid 1.0 | |
set object 2 rect from -2,-70 to 2,70 back | |
set object 2 rect fc rgb "#880055" fillstyle solid 1.0 | |
set size ratio 1 1,1 | |
set xzeroaxis linetype 0 linewidth 1.000 | |
set yzeroaxis linetype 0 linewidth 1.000 | |
set zzeroaxis linetype 0 linewidth 1.000 | |
set title "Concrete/Abstract, Random/Sequential" | |
set xrange [ -70 : 70 ] noreverse nowriteback | |
set yrange [ -70 : 70 ] noreverse nowriteback | |
set xlabel "AR" | |
set x2label "CS" | |
set ylabel "CR" | |
set y2label "AS" | |
set style line 1 lc rgb '#0060ad' lt 1 lw 1 pt 5 ps 1 | |
plot 'results.dat' with linespoints ls 1 | |
replot |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment