diff options
| author | HVukman <peterslopp@googlemail.com> | 2025-08-24 11:21:21 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-08-24 11:21:21 +0200 |
| commit | e3fbd1fea4f9be222d42c378822cabc71d5f0ac0 (patch) | |
| tree | 10fd0f9a2e58fb85acfad5ac0bd39ce3f5165294 | |
| parent | fcbb28dd599241251845b5458337c280c0f38ec7 (diff) | |
| download | perlweeklychallenge-club-e3fbd1fea4f9be222d42c378822cabc71d5f0ac0.tar.gz perlweeklychallenge-club-e3fbd1fea4f9be222d42c378822cabc71d5f0ac0.tar.bz2 perlweeklychallenge-club-e3fbd1fea4f9be222d42c378822cabc71d5f0ac0.zip | |
Add files via upload
| -rw-r--r-- | challenge-335/hvukman/picolisp/335_p2.l | 65 |
1 files changed, 65 insertions, 0 deletions
diff --git a/challenge-335/hvukman/picolisp/335_p2.l b/challenge-335/hvukman/picolisp/335_p2.l new file mode 100644 index 0000000000..6c2f0ff0b1 --- /dev/null +++ b/challenge-335/hvukman/picolisp/335_p2.l @@ -0,0 +1,65 @@ + +(setq magic_square '( (4 9 2) (3 5 7) (8 1 6)) ) + +(de Winner (X) + (if (<= 3 (length X)) + (let (score_a 0 score_b 0) + + (for Y (length X) + + (let (point (get X Y) point_x (get point 1) point_y (get point 2) + magic_square_x (get magic_square (+ 1 point_x)) + magic_square_y (get magic_square_x (+ 1 point_y)) + ) + # magic_square_y as point to get from magic_square + # (println "point " point) + # (println "mpoint " magic_square_y) + + + # every second move by b + (if (= 0 (% Y 2)) + (setq score_b (+ score_b magic_square_y)) + (setq score_a (+ score_a magic_square_y)) + ) + # (println "score_a " score_a) + # (println "score_b " score_b) + (cond + + ( + (= score_a 15) + 'winnerA + ) + ( + (= score_b 15) + 'winnerB + ) + ( + (= Y (length X)) + 'draw + ) + + + ) + + ) + + ) + + ) + 'pending + ) + +) + +(setq games '( ( (0 0) (2 0) (1 1) (2 1) (2 2) ) + ( (0 0) (1 1) (0 1) (0 2) (1 2) (2 0)) + ((0 0) (1 1) (2 0) (1 0) (1 2) (2 1) (0 1) (0 2) (2 2)) + ( (0 0 ) (1 1)) + ( (1 1) (0 0) (2 2) (0 1) (1 0) (0 2)) +) ) + +(for X games + (println (Winner X )) +) + +# (load "perlpico/335_p2.l")
\ No newline at end of file |
