summaryrefslogtreecommitdiff
path: root/README.org
blob: 01f7ef0003ced1ffd68b70d52ed4f7229e5367a8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
* FFNN

This package contains implemenation samples of [[https://en.wikipedia.org/wiki/Feedforward_neural_network][FFNNs]] in [[https://en.wikipedia.org/wiki/Common_Lisp][Common Lisp]]. It is based on the [[https://screwlisp.small-web.org/fundamental/a-better-deep-learning-algorithm/][proposed implementation by Screwlisp]].

** Contents

- [[./algo1.lisp][A simple, single-layer NN that can propose the next step of a tic-tac-toe game]]

** Example usage

#+begin_src lisp
  (when nil
  (let ((training-data
	  '(;; 1. Horizontal Win (Top Row)
	    (((foo) (foo) (foo))
	     (( )   ( )   ( ))
	     (( )   ( )   ( )))

	    ;; 2. Vertical Win (Left Column)
	    (((foo) ( )   ( ))
	     ((foo) ( )   ( ))
	     ((foo) ( )   ( )))

	    ;; 3. Diagonal Win (Top-Left to Bottom-Right)
	    (((foo) ( )   ( ))
	     (( )   (foo) ( ))
	     (( )   ( )   (foo)))

	    ;; 4. Diagonal Win (Top-Right to Bottom-Left)
	    ((( )   ( )   (foo))
	     (( )   (foo) ( ))
	     ((foo) ( )   ( )))))
	(board
	  '(((foo) (foo) ( )) ;; Potential win at (0, 2)
	    ((bar) ( )   ( ))
	    (( )   (bar) ( )))))
    (play-ttt board training-data))
  ;; Output: '((0 . 2))
  )
#+end_src