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
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | |
;; Make N Game Solver | |
;; Naiive version | |
;; 11.24.2014 | |
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | |
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | |
;; Settings | |
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | |
(defvar *target* 10) |
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
#coding: utf-8 | |
from itertools import combinations | |
from collections import Counter | |
from operator import * | |
import random | |
targetNum = 10 | |
numlist = sorted([random.randint(1,100) for i in range(100)]) | |
searchMode = 0 | |
# 0: Randomized search (fast for long number lists, doesn't stop if no solutions exist) |
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
(defmacro defmacro-varargsify [m margs &rest mbody] | |
" | |
Defines an N-argument macro to a n*N-argument macro, | |
where the original macro is applied using each of the N arguments. | |
Example: | |
(defmacro-varargsify a [x y] | |
`(print (+ ~x ~y))) | |
(a 1 2 3 4 5 6) |
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
;;; Same, but with macros | |
(defmacro pm [expr &rest args] | |
(defn _listlike? [l] | |
(or | |
(= hy.models.HyList (type l)) | |
(= hy.models.HyExpression (type l)) | |
(= list (type l)))) | |
(defn _recursive-count [l] |
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
1 ジーランス 2.81552027301750 53 [136, 71, 55, 36, 24, 17, 16, 15, 14, 11, 10, 9, 8, 8, 7, 6, 6, 5, 4, 4, 3, 3, 3, 3, 3, 2, 2, 2, 2, 2, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1] | |
2 レントラー 2.80590281618208 46 [143, 54, 54, 38, 22, 21, 21, 15, 13, 12, 9, 9, 9, 7, 7, 7, 6, 5, 5, 5, 5, 5, 3, 3, 3, 3, 3, 2, 2, 2, 2, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1] | |
3 ネンドール 2.76650256510168 44 [152, 57, 52, 30, 25, 22, 19, 15, 13, 10, 9, 8, 8, 7, 6, 6, 6, 5, 5, 5, 5, 4, 4, 4, 4, 3, 3, 3, 2, 2, 2, 2, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1] | |
4 グラードン 2.75490681338029 58 [163, 78, 36, 30, 22, 16, 15, 12, 11, 11, 11, 10, 9, 7, 5, 4, 4, 4, 4, 3, 3, 3, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1] | |
5 ランクルス 2.73260697699840 48 [152, 60, 53, 32, 31, 20, 17, 14, 14, 11, 10, 9, 8, 7, 7, 6, 5, 4, 4, 4, 3, 3, 3, 3, 2, 2, 2, 2, 2, 2, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1] | |
6 ルナトーン 2.71418343665737 46 [145, 56, 47, 39, 34, 32, 18, 16, |
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
1 ジーランス 2.81829961417558 53 [137, 71, 55, 36, 24, 18, 18, 15, 14, 11, 10, 10, 8, 8, 7, 6, 6, 5, 4, 4, 3, 3, 3, 3, 3, 2, 2, 2, 2, 2, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1] | |
2 レントラー 2.81370559638248 47 [143, 56, 54, 38, 22, 22, 22, 15, 13, 12, 9, 9, 9, 7, 7, 7, 6, 5, 5, 5, 5, 5, 3, 3, 3, 3, 3, 2, 2, 2, 2, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1] | |
3 ネンドール 2.75997489897431 44 [154, 57, 54, 30, 25, 22, 19, 16, 13, 10, 9, 8, 8, 7, 6, 6, 6, 5, 5, 5, 5, 4, 4, 4, 4, 3, 3, 3, 2, 2, 2, 2, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1] | |
4 グラードン 2.75770580942433 58 [164, 78, 36, 32, 23, 16, 15, 12, 11, 11, 11, 10, 9, 7, 5, 4, 4, 4, 4, 3, 3, 3, 3, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1] | |
5 ランクルス 2.73115286105027 48 [153, 63, 53, 32, 31, 20, 17, 14, 14, 11, 10, 9, 8, 7, 7, 6, 5, 4, 4, 4, 3, 3, 3, 3, 3, 2, 2, 2, 2, 2, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1] | |
6 ルナトーン 2.72005023450342 46 [145, 56, 47, 41, 34, 32, 19, |
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
1 マンキー 3.00312777465967 61 [186, 152, 63, 62, 45, 42, 40, 30, 26, 23, 19, 18, 14, 14, 10, 10, 10, 9, 9, 9, 8, 8, 7, 7, 7, 5, 5, 4, 4, 4, 4, 4, 4, 3, 3, 3, 2, 2, 2, 2, 2, 2, 2, 2, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1] | |
2 チリーン 2.96396350655794 72 [191, 166, 85, 65, 44, 32, 26, 23, 21, 19, 18, 17, 16, 14, 13, 11, 11, 10, 9, 9, 8, 6, 4, 4, 4, 4, 4, 3, 3, 3, 3, 3, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1] | |
3 マンムー 2.96375620314442 65 [191, 151, 72, 67, 42, 40, 38, 30, 27, 23, 18, 18, 13, 13, 13, 11, 11, 9, 9, 9, 9, 8, 5, 5, 5, 4, 4, 4, 4, 3, 3, 3, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1] | |
4 コクーン 2.95295816571321 66 [186, 159, 94, 69, 41, 33, 27, 24, 21, 21, 19, 19, 17, 14, 11, 9, 9, 9, 8, 7, 7, 6, 6, 6, 5, 5, 5, 4, 4, 4, 4, 3, 3, 3, 3, 2, 2, 2, 2, 2, 2, 2, 2, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1] | |
5 ガルーラ 2.91500277145171 6 |
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
# A solver for https://twitter.com/ikeikey/status/1543710547874615297 | |
import numpy as np | |
def search(A, l_count, handlist, i, j): | |
if i == 7 and j == 7: | |
return A | |
elif i == j: | |
return search(A, l_count, handlist, i, j+1) | |
l_count = list(l_count) |
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
;; Original code: https://github.com/jart/sectorlisp/blob/main/lisp.lisp | |
;; Runs on LambdaLisp: https://github.com/woodrush/lambdalisp | |
(let ((assoc*) (evcon) (pairlis) (evlis) (apply*) (eval*)) | |
(setq assoc* | |
(lambda (x y) | |
(cond ((eq y ()) ()) | |
((eq x (car (car y))) | |
(cdr (car y))) | |
((quote t) | |
(assoc* x (cdr y)))))) |
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
;; Original code: https://github.com/jart/sectorlisp/blob/main/lisp.lisp | |
;; Runs on LambdaLisp: https://github.com/woodrush/lambdalisp | |
(let ((assoc*) (evcon) (pairlis) (evlis) (apply*) (eval*)) | |
(setq assoc* | |
(lambda (x y) | |
(cond ((eq y ()) ()) | |
((eq x (car (car y))) | |
(cdr (car y))) | |
((quote t) | |
(assoc* x (cdr y)))))) |
OlderNewer