gnu: Add lead-solver.

* gnu/packages/games.scm (lead-solver): New variable.

Change-Id: I5b126d1173e80cab6a588a08887c47d2f981890d
This commit is contained in:
Nicolas Goaziou 2024-08-28 23:43:38 +02:00
parent 77ca6b3108
commit dbc64bef16
No known key found for this signature in database
GPG key ID: DA00B4F048E92F2D

View file

@ -10259,54 +10259,104 @@ remake of that series or any other game.")
;; released under lgpl2.1+. ;; released under lgpl2.1+.
(license (list license:gpl2 license:cc-by-sa3.0 license:lgpl2.1+)))) (license (list license:gpl2 license:cc-by-sa3.0 license:lgpl2.1+))))
(define-public lead-solver
(package
(name "lead-solver")
(version "1.0.2")
(source (origin
(method url-fetch)
(uri (let ((v (apply string-append (string-split version #\.))))
(string-append
"https://lajollabridge.com/Software/Lead-Solver/"
"leadsolver-" v ".zip")))
(sha256
(base32
"0xsa7r6r5sprgy0pkdm1xj1jwyy6d3qak2ynviy8xplicl99q09f"))
(modules '((guix build utils)
(ice-9 ftw)))
(snippet
#~(begin
;; Remove pre-built executables and cruft relative
;; to other OSes.
(for-each
delete-file-recursively
(scandir "."
(lambda (f)
(not (member f '("." ".." "leadsolver.cpp"))))))
(substitute* "leadsolver.cpp"
(("#include \"dll.h\"") "#include <dll.h>"))))))
(build-system gnu-build-system)
(arguments
(list #:tests? #false ;no tests
#:phases
#~(modify-phases %standard-phases
(delete 'configure) ;no configure script
(replace 'build
(lambda _
(invoke "g++" "leadsolver.cpp" "-ldds" "-o" "leadsolver")))
(replace 'install ;no install phase
(lambda _
(let ((bin (string-append #$output "/bin")))
(install-file "leadsolver" bin)))))))
(native-inputs (list unzip))
(inputs (list dds))
(home-page
"https://lajollabridge.com/Software/Lead-Solver/Lead-Solver-About.htm")
(synopsis "Analyze leads in bridge game")
(description
"Given bridge hands, Lead Solver tallies up how well each card does when
led in terms of average tricks taken for the defense (for matchpoints) and how
often the contract is set (for team play).")
(license license:gpl3)))
(define-public leela-zero (define-public leela-zero
(package (package
(name "leela-zero") (name "leela-zero")
(version "0.17") (version "0.17")
(source (source
(origin (origin
(method git-fetch) (method git-fetch)
(uri (git-reference (uri (git-reference
(url "https://github.com/leela-zero/leela-zero") (url "https://github.com/leela-zero/leela-zero")
(commit (string-append "v" version)))) (commit (string-append "v" version))))
(file-name (git-file-name name version)) (file-name (git-file-name name version))
(sha256 (sha256
(base32 (base32
"17px5iny8mql5c01bymcli7zfssswkzvb2i8gnsmjcck6i2n8srl")) "17px5iny8mql5c01bymcli7zfssswkzvb2i8gnsmjcck6i2n8srl"))
(patches (search-patches "leela-zero-gtest.patch")))) (patches (search-patches "leela-zero-gtest.patch"))))
(build-system cmake-build-system) (build-system cmake-build-system)
(native-inputs (native-inputs
(list googletest)) (list googletest))
(inputs (inputs
(list boost (list boost
opencl-icd-loader opencl-icd-loader
openblas openblas
opencl-headers opencl-headers
qtbase-5 qtbase-5
zlib)) zlib))
(arguments (arguments
'(#:configure-flags '("-DUSE_BLAS=YES") '(#:configure-flags '("-DUSE_BLAS=YES")
#:phases (modify-phases %standard-phases #:phases (modify-phases %standard-phases
(add-before 'configure 'fix-tests (add-before 'configure 'fix-tests
(lambda* (#:key outputs #:allow-other-keys) (lambda* (#:key outputs #:allow-other-keys)
(let ((home (getcwd))) (let ((home (getcwd)))
(setenv "HOME" home) (setenv "HOME" home)
(substitute* "src/tests/gtests.cpp" (substitute* "src/tests/gtests.cpp"
(("\\.\\./src/tests/0k\\.txt") (("\\.\\./src/tests/0k\\.txt")
(string-append home "/src/tests/0k.txt")) (string-append home "/src/tests/0k.txt"))
(("cfg_gtp_mode = true;") (("cfg_gtp_mode = true;")
"cfg_gtp_mode = true; cfg_cpu_only = true;"))) "cfg_gtp_mode = true; cfg_cpu_only = true;")))
#t)) #t))
(replace 'check (replace 'check
(lambda _ (lambda _
(invoke "./tests")))))) (invoke "./tests"))))))
(home-page "https://github.com/leela-zero/leela-zero") (home-page "https://github.com/leela-zero/leela-zero")
(synopsis "Program playing the game of Go") (synopsis "Program playing the game of Go")
(description (description
"Leela-zero is a Go engine with no human-provided knowledge, modeled after "Leela-zero is a Go engine with no human-provided knowledge, modeled after
the AlphaGo Zero paper. The current best network weights file for the engine the AlphaGo Zero paper. The current best network weights file for the engine
can be downloaded from @url{https://zero.sjeng.org/best-network}.") can be downloaded from @url{https://zero.sjeng.org/best-network}.")
(license license:gpl3+))) (license license:gpl3+)))
(define-public q5go (define-public q5go
(package (package