miniosl 0.0.3a1__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- miniosl-0.0.3a1/AUTHORS.osl +11 -0
- miniosl-0.0.3a1/LICENSE.osl +57 -0
- miniosl-0.0.3a1/MANIFEST.in +2 -0
- miniosl-0.0.3a1/PKG-INFO +32 -0
- miniosl-0.0.3a1/README.md +20 -0
- miniosl-0.0.3a1/miniosl/__init__.py +7 -0
- miniosl-0.0.3a1/miniosl/drawing.py +178 -0
- miniosl-0.0.3a1/miniosl/record.py +60 -0
- miniosl-0.0.3a1/miniosl/state.py +142 -0
- miniosl-0.0.3a1/miniosl.egg-info/PKG-INFO +32 -0
- miniosl-0.0.3a1/miniosl.egg-info/SOURCES.txt +222 -0
- miniosl-0.0.3a1/miniosl.egg-info/dependency_links.txt +1 -0
- miniosl-0.0.3a1/miniosl.egg-info/not-zip-safe +1 -0
- miniosl-0.0.3a1/miniosl.egg-info/top_level.txt +2 -0
- miniosl-0.0.3a1/minioslcc/CMakeLists.txt +49 -0
- miniosl-0.0.3a1/minioslcc/acutest/CMakeLists.txt +44 -0
- miniosl-0.0.3a1/minioslcc/acutest/LICENSE.md +22 -0
- miniosl-0.0.3a1/minioslcc/acutest/README.md +457 -0
- miniosl-0.0.3a1/minioslcc/acutest/examples/CMakeLists.txt +5 -0
- miniosl-0.0.3a1/minioslcc/acutest/examples/cpp-example.cc +115 -0
- miniosl-0.0.3a1/minioslcc/acutest/include/acutest.h +1839 -0
- miniosl-0.0.3a1/minioslcc/gbuild/CMakeFiles/3.22.1/CMakeCXXCompiler.cmake +83 -0
- miniosl-0.0.3a1/minioslcc/gbuild/CMakeFiles/3.22.1/CMakeSystem.cmake +15 -0
- miniosl-0.0.3a1/minioslcc/gbuild/CMakeFiles/CMakeDirectoryInformation.cmake +16 -0
- miniosl-0.0.3a1/minioslcc/gbuild/CMakeFiles/Makefile.cmake +67 -0
- miniosl-0.0.3a1/minioslcc/gbuild/CMakeFiles/csa-to-sfen.dir/DependInfo.cmake +20 -0
- miniosl-0.0.3a1/minioslcc/gbuild/CMakeFiles/csa-to-sfen.dir/cmake_clean.cmake +11 -0
- miniosl-0.0.3a1/minioslcc/gbuild/CMakeFiles/minioslcc.dir/DependInfo.cmake +20 -0
- miniosl-0.0.3a1/minioslcc/gbuild/CMakeFiles/minioslcc.dir/cmake_clean.cmake +11 -0
- miniosl-0.0.3a1/minioslcc/gbuild/CMakeFiles/minioslcc20.dir/DependInfo.cmake +22 -0
- miniosl-0.0.3a1/minioslcc/gbuild/CMakeFiles/minioslcc20.dir/cmake_clean.cmake +17 -0
- miniosl-0.0.3a1/minioslcc/gbuild/CMakeFiles/minitest.dir/DependInfo.cmake +20 -0
- miniosl-0.0.3a1/minioslcc/gbuild/CMakeFiles/minitest.dir/cmake_clean.cmake +11 -0
- miniosl-0.0.3a1/minioslcc/gbuild/CMakeFiles/minitest_file.dir/DependInfo.cmake +20 -0
- miniosl-0.0.3a1/minioslcc/gbuild/CMakeFiles/minitest_file.dir/cmake_clean.cmake +11 -0
- miniosl-0.0.3a1/minioslcc/gbuild/CMakeFiles/validate-sfen.dir/DependInfo.cmake +20 -0
- miniosl-0.0.3a1/minioslcc/gbuild/CMakeFiles/validate-sfen.dir/cmake_clean.cmake +11 -0
- miniosl-0.0.3a1/minioslcc/gbuild/CTestTestfile.cmake +11 -0
- miniosl-0.0.3a1/minioslcc/gbuild/cmake_install.cmake +59 -0
- miniosl-0.0.3a1/minioslcc/gbuild/pybind11/CMakeFiles/CMakeDirectoryInformation.cmake +16 -0
- miniosl-0.0.3a1/minioslcc/gbuild/pybind11/cmake_install.cmake +44 -0
- miniosl-0.0.3a1/minioslcc/pybind11/.cmake-format.yaml +73 -0
- miniosl-0.0.3a1/minioslcc/pybind11/.pre-commit-config.yaml +149 -0
- miniosl-0.0.3a1/minioslcc/pybind11/CMakeLists.txt +321 -0
- miniosl-0.0.3a1/minioslcc/pybind11/LICENSE +29 -0
- miniosl-0.0.3a1/minioslcc/pybind11/MANIFEST.in +6 -0
- miniosl-0.0.3a1/minioslcc/pybind11/README.rst +180 -0
- miniosl-0.0.3a1/minioslcc/pybind11/docs/benchmark.py +87 -0
- miniosl-0.0.3a1/minioslcc/pybind11/docs/conf.py +368 -0
- miniosl-0.0.3a1/minioslcc/pybind11/include/pybind11/attr.h +690 -0
- miniosl-0.0.3a1/minioslcc/pybind11/include/pybind11/buffer_info.h +193 -0
- miniosl-0.0.3a1/minioslcc/pybind11/include/pybind11/cast.h +1704 -0
- miniosl-0.0.3a1/minioslcc/pybind11/include/pybind11/chrono.h +225 -0
- miniosl-0.0.3a1/minioslcc/pybind11/include/pybind11/common.h +2 -0
- miniosl-0.0.3a1/minioslcc/pybind11/include/pybind11/complex.h +74 -0
- miniosl-0.0.3a1/minioslcc/pybind11/include/pybind11/detail/class.h +743 -0
- miniosl-0.0.3a1/minioslcc/pybind11/include/pybind11/detail/common.h +1249 -0
- miniosl-0.0.3a1/minioslcc/pybind11/include/pybind11/detail/descr.h +171 -0
- miniosl-0.0.3a1/minioslcc/pybind11/include/pybind11/detail/init.h +434 -0
- miniosl-0.0.3a1/minioslcc/pybind11/include/pybind11/detail/internals.h +656 -0
- miniosl-0.0.3a1/minioslcc/pybind11/include/pybind11/detail/type_caster_base.h +1177 -0
- miniosl-0.0.3a1/minioslcc/pybind11/include/pybind11/detail/typeid.h +65 -0
- miniosl-0.0.3a1/minioslcc/pybind11/include/pybind11/eigen/matrix.h +701 -0
- miniosl-0.0.3a1/minioslcc/pybind11/include/pybind11/eigen/tensor.h +511 -0
- miniosl-0.0.3a1/minioslcc/pybind11/include/pybind11/eigen.h +12 -0
- miniosl-0.0.3a1/minioslcc/pybind11/include/pybind11/embed.h +316 -0
- miniosl-0.0.3a1/minioslcc/pybind11/include/pybind11/eval.h +156 -0
- miniosl-0.0.3a1/minioslcc/pybind11/include/pybind11/functional.h +137 -0
- miniosl-0.0.3a1/minioslcc/pybind11/include/pybind11/gil.h +239 -0
- miniosl-0.0.3a1/minioslcc/pybind11/include/pybind11/iostream.h +265 -0
- miniosl-0.0.3a1/minioslcc/pybind11/include/pybind11/numpy.h +1992 -0
- miniosl-0.0.3a1/minioslcc/pybind11/include/pybind11/operators.h +202 -0
- miniosl-0.0.3a1/minioslcc/pybind11/include/pybind11/options.h +92 -0
- miniosl-0.0.3a1/minioslcc/pybind11/include/pybind11/pybind11.h +2890 -0
- miniosl-0.0.3a1/minioslcc/pybind11/include/pybind11/pytypes.h +2487 -0
- miniosl-0.0.3a1/minioslcc/pybind11/include/pybind11/stl/filesystem.h +116 -0
- miniosl-0.0.3a1/minioslcc/pybind11/include/pybind11/stl.h +447 -0
- miniosl-0.0.3a1/minioslcc/pybind11/include/pybind11/stl_bind.h +851 -0
- miniosl-0.0.3a1/minioslcc/pybind11/include/pybind11/type_caster_pyobject_ptr.h +61 -0
- miniosl-0.0.3a1/minioslcc/pybind11/noxfile.py +107 -0
- miniosl-0.0.3a1/minioslcc/pybind11/pybind11/__init__.py +17 -0
- miniosl-0.0.3a1/minioslcc/pybind11/pybind11/__main__.py +62 -0
- miniosl-0.0.3a1/minioslcc/pybind11/pybind11/_version.py +12 -0
- miniosl-0.0.3a1/minioslcc/pybind11/pybind11/commands.py +37 -0
- miniosl-0.0.3a1/minioslcc/pybind11/pybind11/setup_helpers.py +498 -0
- miniosl-0.0.3a1/minioslcc/pybind11/setup.cfg +42 -0
- miniosl-0.0.3a1/minioslcc/pybind11/setup.py +150 -0
- miniosl-0.0.3a1/minioslcc/pybind11/tests/CMakeLists.txt +587 -0
- miniosl-0.0.3a1/minioslcc/pybind11/tests/conftest.py +221 -0
- miniosl-0.0.3a1/minioslcc/pybind11/tests/constructor_stats.h +322 -0
- miniosl-0.0.3a1/minioslcc/pybind11/tests/env.py +27 -0
- miniosl-0.0.3a1/minioslcc/pybind11/tests/extra_python_package/test_files.py +289 -0
- miniosl-0.0.3a1/minioslcc/pybind11/tests/extra_setuptools/test_setuphelper.py +151 -0
- miniosl-0.0.3a1/minioslcc/pybind11/tests/local_bindings.h +92 -0
- miniosl-0.0.3a1/minioslcc/pybind11/tests/object.h +205 -0
- miniosl-0.0.3a1/minioslcc/pybind11/tests/pybind11_tests.h +85 -0
- miniosl-0.0.3a1/minioslcc/pybind11/tests/test_async.py +24 -0
- miniosl-0.0.3a1/minioslcc/pybind11/tests/test_buffers.py +164 -0
- miniosl-0.0.3a1/minioslcc/pybind11/tests/test_builtin_casters.py +528 -0
- miniosl-0.0.3a1/minioslcc/pybind11/tests/test_call_policies.py +247 -0
- miniosl-0.0.3a1/minioslcc/pybind11/tests/test_callbacks.py +218 -0
- miniosl-0.0.3a1/minioslcc/pybind11/tests/test_chrono.py +205 -0
- miniosl-0.0.3a1/minioslcc/pybind11/tests/test_class.py +485 -0
- miniosl-0.0.3a1/minioslcc/pybind11/tests/test_cmake_build/CMakeLists.txt +84 -0
- miniosl-0.0.3a1/minioslcc/pybind11/tests/test_cmake_build/installed_embed/CMakeLists.txt +28 -0
- miniosl-0.0.3a1/minioslcc/pybind11/tests/test_cmake_build/installed_function/CMakeLists.txt +39 -0
- miniosl-0.0.3a1/minioslcc/pybind11/tests/test_cmake_build/installed_target/CMakeLists.txt +46 -0
- miniosl-0.0.3a1/minioslcc/pybind11/tests/test_cmake_build/subdirectory_embed/CMakeLists.txt +41 -0
- miniosl-0.0.3a1/minioslcc/pybind11/tests/test_cmake_build/subdirectory_function/CMakeLists.txt +35 -0
- miniosl-0.0.3a1/minioslcc/pybind11/tests/test_cmake_build/subdirectory_target/CMakeLists.txt +41 -0
- miniosl-0.0.3a1/minioslcc/pybind11/tests/test_cmake_build/test.py +8 -0
- miniosl-0.0.3a1/minioslcc/pybind11/tests/test_const_name.py +29 -0
- miniosl-0.0.3a1/minioslcc/pybind11/tests/test_constants_and_functions.py +56 -0
- miniosl-0.0.3a1/minioslcc/pybind11/tests/test_copy_move.py +132 -0
- miniosl-0.0.3a1/minioslcc/pybind11/tests/test_custom_type_casters.py +122 -0
- miniosl-0.0.3a1/minioslcc/pybind11/tests/test_custom_type_setup.py +48 -0
- miniosl-0.0.3a1/minioslcc/pybind11/tests/test_docstring_options.py +64 -0
- miniosl-0.0.3a1/minioslcc/pybind11/tests/test_eigen_matrix.py +807 -0
- miniosl-0.0.3a1/minioslcc/pybind11/tests/test_eigen_tensor.py +288 -0
- miniosl-0.0.3a1/minioslcc/pybind11/tests/test_embed/CMakeLists.txt +47 -0
- miniosl-0.0.3a1/minioslcc/pybind11/tests/test_embed/test_interpreter.py +14 -0
- miniosl-0.0.3a1/minioslcc/pybind11/tests/test_embed/test_trampoline.py +16 -0
- miniosl-0.0.3a1/minioslcc/pybind11/tests/test_enum.py +266 -0
- miniosl-0.0.3a1/minioslcc/pybind11/tests/test_eval.py +50 -0
- miniosl-0.0.3a1/minioslcc/pybind11/tests/test_eval_call.py +4 -0
- miniosl-0.0.3a1/minioslcc/pybind11/tests/test_exceptions.h +13 -0
- miniosl-0.0.3a1/minioslcc/pybind11/tests/test_exceptions.py +393 -0
- miniosl-0.0.3a1/minioslcc/pybind11/tests/test_factory_constructors.py +516 -0
- miniosl-0.0.3a1/minioslcc/pybind11/tests/test_gil_scoped.py +242 -0
- miniosl-0.0.3a1/minioslcc/pybind11/tests/test_iostream.py +291 -0
- miniosl-0.0.3a1/minioslcc/pybind11/tests/test_kwargs_and_defaults.py +389 -0
- miniosl-0.0.3a1/minioslcc/pybind11/tests/test_local_bindings.py +257 -0
- miniosl-0.0.3a1/minioslcc/pybind11/tests/test_methods_and_attributes.py +533 -0
- miniosl-0.0.3a1/minioslcc/pybind11/tests/test_modules.py +116 -0
- miniosl-0.0.3a1/minioslcc/pybind11/tests/test_multiple_inheritance.py +493 -0
- miniosl-0.0.3a1/minioslcc/pybind11/tests/test_numpy_array.py +597 -0
- miniosl-0.0.3a1/minioslcc/pybind11/tests/test_numpy_dtypes.py +440 -0
- miniosl-0.0.3a1/minioslcc/pybind11/tests/test_numpy_vectorize.py +266 -0
- miniosl-0.0.3a1/minioslcc/pybind11/tests/test_opaque_types.py +58 -0
- miniosl-0.0.3a1/minioslcc/pybind11/tests/test_operator_overloading.py +151 -0
- miniosl-0.0.3a1/minioslcc/pybind11/tests/test_pickling.py +93 -0
- miniosl-0.0.3a1/minioslcc/pybind11/tests/test_pytypes.py +885 -0
- miniosl-0.0.3a1/minioslcc/pybind11/tests/test_sequences_and_iterators.py +252 -0
- miniosl-0.0.3a1/minioslcc/pybind11/tests/test_smart_ptr.py +315 -0
- miniosl-0.0.3a1/minioslcc/pybind11/tests/test_stl.py +378 -0
- miniosl-0.0.3a1/minioslcc/pybind11/tests/test_stl_binders.py +355 -0
- miniosl-0.0.3a1/minioslcc/pybind11/tests/test_tagbased_polymorphic.py +28 -0
- miniosl-0.0.3a1/minioslcc/pybind11/tests/test_thread.py +42 -0
- miniosl-0.0.3a1/minioslcc/pybind11/tests/test_type_caster_pyobject_ptr.py +104 -0
- miniosl-0.0.3a1/minioslcc/pybind11/tests/test_union.py +8 -0
- miniosl-0.0.3a1/minioslcc/pybind11/tests/test_unnamed_namespace_a.py +34 -0
- miniosl-0.0.3a1/minioslcc/pybind11/tests/test_unnamed_namespace_b.py +5 -0
- miniosl-0.0.3a1/minioslcc/pybind11/tests/test_vector_unique_ptr_member.py +14 -0
- miniosl-0.0.3a1/minioslcc/pybind11/tests/test_virtual_functions.py +458 -0
- miniosl-0.0.3a1/minioslcc/pybind11/tools/FindCatch.cmake +76 -0
- miniosl-0.0.3a1/minioslcc/pybind11/tools/FindEigen3.cmake +86 -0
- miniosl-0.0.3a1/minioslcc/pybind11/tools/FindPythonLibsNew.cmake +287 -0
- miniosl-0.0.3a1/minioslcc/pybind11/tools/JoinPaths.cmake +23 -0
- miniosl-0.0.3a1/minioslcc/pybind11/tools/cmake_uninstall.cmake.in +23 -0
- miniosl-0.0.3a1/minioslcc/pybind11/tools/codespell_ignore_lines_from_errors.py +39 -0
- miniosl-0.0.3a1/minioslcc/pybind11/tools/libsize.py +36 -0
- miniosl-0.0.3a1/minioslcc/pybind11/tools/make_changelog.py +62 -0
- miniosl-0.0.3a1/minioslcc/pybind11/tools/pybind11.pc.in +7 -0
- miniosl-0.0.3a1/minioslcc/pybind11/tools/pybind11Common.cmake +397 -0
- miniosl-0.0.3a1/minioslcc/pybind11/tools/pybind11Config.cmake.in +231 -0
- miniosl-0.0.3a1/minioslcc/pybind11/tools/pybind11NewTools.cmake +256 -0
- miniosl-0.0.3a1/minioslcc/pybind11/tools/pybind11Tools.cmake +233 -0
- miniosl-0.0.3a1/minioslcc/pybind11/tools/setup_global.py.in +63 -0
- miniosl-0.0.3a1/minioslcc/pybind11/tools/setup_main.py.in +44 -0
- miniosl-0.0.3a1/minioslcc/rbuild/CMakeFiles/3.22.1/CMakeCXXCompiler.cmake +83 -0
- miniosl-0.0.3a1/minioslcc/rbuild/CMakeFiles/3.22.1/CMakeSystem.cmake +15 -0
- miniosl-0.0.3a1/minioslcc/rbuild/CMakeFiles/CMakeDirectoryInformation.cmake +16 -0
- miniosl-0.0.3a1/minioslcc/rbuild/CMakeFiles/Makefile.cmake +67 -0
- miniosl-0.0.3a1/minioslcc/rbuild/CMakeFiles/csa-to-sfen.dir/DependInfo.cmake +20 -0
- miniosl-0.0.3a1/minioslcc/rbuild/CMakeFiles/csa-to-sfen.dir/cmake_clean.cmake +11 -0
- miniosl-0.0.3a1/minioslcc/rbuild/CMakeFiles/minioslcc.dir/DependInfo.cmake +20 -0
- miniosl-0.0.3a1/minioslcc/rbuild/CMakeFiles/minioslcc.dir/cmake_clean.cmake +11 -0
- miniosl-0.0.3a1/minioslcc/rbuild/CMakeFiles/minioslcc20.dir/DependInfo.cmake +22 -0
- miniosl-0.0.3a1/minioslcc/rbuild/CMakeFiles/minioslcc20.dir/cmake_clean.cmake +17 -0
- miniosl-0.0.3a1/minioslcc/rbuild/CMakeFiles/minitest.dir/DependInfo.cmake +20 -0
- miniosl-0.0.3a1/minioslcc/rbuild/CMakeFiles/minitest.dir/cmake_clean.cmake +11 -0
- miniosl-0.0.3a1/minioslcc/rbuild/CMakeFiles/minitest_file.dir/DependInfo.cmake +20 -0
- miniosl-0.0.3a1/minioslcc/rbuild/CMakeFiles/minitest_file.dir/cmake_clean.cmake +11 -0
- miniosl-0.0.3a1/minioslcc/rbuild/CMakeFiles/validate-sfen.dir/DependInfo.cmake +20 -0
- miniosl-0.0.3a1/minioslcc/rbuild/CMakeFiles/validate-sfen.dir/cmake_clean.cmake +11 -0
- miniosl-0.0.3a1/minioslcc/rbuild/CTestTestfile.cmake +11 -0
- miniosl-0.0.3a1/minioslcc/rbuild/cmake_install.cmake +59 -0
- miniosl-0.0.3a1/minioslcc/rbuild/pybind11/CMakeFiles/CMakeDirectoryInformation.cmake +16 -0
- miniosl-0.0.3a1/minioslcc/rbuild/pybind11/cmake_install.cmake +44 -0
- miniosl-0.0.3a1/minioslcc/src/checkmate.cc +974 -0
- miniosl-0.0.3a1/minioslcc/src/checkmate.h +176 -0
- miniosl-0.0.3a1/minioslcc/src/miniosl.cc +263 -0
- miniosl-0.0.3a1/minioslcc/src/more.cc +821 -0
- miniosl-0.0.3a1/minioslcc/src/more.h +992 -0
- miniosl-0.0.3a1/minioslcc/src/record.cc +1279 -0
- miniosl-0.0.3a1/minioslcc/src/record.h +188 -0
- miniosl-0.0.3a1/minioslcc/src/state.cc +1869 -0
- miniosl-0.0.3a1/minioslcc/src/state.h +2456 -0
- miniosl-0.0.3a1/minioslcc/tbuild/CMakeFiles/3.26.3/CMakeCXXCompiler.cmake +83 -0
- miniosl-0.0.3a1/minioslcc/tbuild/CMakeFiles/3.26.3/CMakeSystem.cmake +15 -0
- miniosl-0.0.3a1/minioslcc/tbuild/CMakeFiles/CMakeConfigureLog.yaml +320 -0
- miniosl-0.0.3a1/minioslcc/tbuild/CMakeFiles/CMakeDirectoryInformation.cmake +16 -0
- miniosl-0.0.3a1/minioslcc/tbuild/CMakeFiles/Makefile.cmake +126 -0
- miniosl-0.0.3a1/minioslcc/tbuild/CMakeFiles/minioslcc.dir/DependInfo.cmake +19 -0
- miniosl-0.0.3a1/minioslcc/tbuild/CMakeFiles/minioslcc.dir/cmake_clean.cmake +11 -0
- miniosl-0.0.3a1/minioslcc/tbuild/CMakeFiles/minioslcc20.dir/DependInfo.cmake +21 -0
- miniosl-0.0.3a1/minioslcc/tbuild/CMakeFiles/minioslcc20.dir/cmake_clean.cmake +15 -0
- miniosl-0.0.3a1/minioslcc/tbuild/CMakeFiles/minitest.dir/DependInfo.cmake +19 -0
- miniosl-0.0.3a1/minioslcc/tbuild/CMakeFiles/minitest.dir/cmake_clean.cmake +11 -0
- miniosl-0.0.3a1/minioslcc/tbuild/CMakeFiles/minitest_file.dir/DependInfo.cmake +19 -0
- miniosl-0.0.3a1/minioslcc/tbuild/CMakeFiles/minitest_file.dir/cmake_clean.cmake +11 -0
- miniosl-0.0.3a1/minioslcc/tbuild/CTestTestfile.cmake +11 -0
- miniosl-0.0.3a1/minioslcc/tbuild/cmake_install.cmake +59 -0
- miniosl-0.0.3a1/minioslcc/tbuild/pybind11/CMakeFiles/CMakeDirectoryInformation.cmake +16 -0
- miniosl-0.0.3a1/minioslcc/tbuild/pybind11/cmake_install.cmake +44 -0
- miniosl-0.0.3a1/minioslcc/test/minitest.cc +4687 -0
- miniosl-0.0.3a1/minioslcc/test/minitest_file.cc +459 -0
- miniosl-0.0.3a1/minioslcc/util/compress-sfen.cc +89 -0
- miniosl-0.0.3a1/minioslcc/util/csa-to-sfen.cc +33 -0
- miniosl-0.0.3a1/minioslcc/util/validate-sfen.cc +107 -0
- miniosl-0.0.3a1/setup.cfg +4 -0
- miniosl-0.0.3a1/setup.py +197 -0
- miniosl-0.0.3a1/tests/test_record.py +11 -0
- miniosl-0.0.3a1/tests/test_state.py +138 -0
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
---------------
|
|
2
|
+
Authors: Team GPS
|
|
3
|
+
|
|
4
|
+
TANAKA Tetsurou 田中 哲朗 <ktanaka at ecc dot u-tokyo dot ac dot jp>
|
|
5
|
+
KANEKO Tomoyuki 金子 知適 <kaneko at graco dot c dot u-tokyo dot ac dot jp>
|
|
6
|
+
MORIWAKI Daigo 森脇 大悟 <daigo at debian dot org>
|
|
7
|
+
SOEDA Shunsuke 副田 俊介 <me at shnsk dot net>
|
|
8
|
+
HAYASHI Yoshiki 林 芳樹 <yoshiki at xemacs dot org>
|
|
9
|
+
TAKEUCHI Shougo 竹内 聖悟 <takeuchi at erato dot ist dot hokudai dot ac dot jp>
|
|
10
|
+
|
|
11
|
+
---------------
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
Copyright (C) 2003-2014 Team GPS.
|
|
2
|
+
|
|
3
|
+
Redistribution and use in source and binary forms, with or without
|
|
4
|
+
modification, are permitted provided that the following conditions are
|
|
5
|
+
met:
|
|
6
|
+
|
|
7
|
+
Redistributions of source code must retain the above copyright notice,
|
|
8
|
+
this list of conditions and the following disclaimer.
|
|
9
|
+
|
|
10
|
+
Redistributions in binary form must reproduce the above copyright
|
|
11
|
+
notice, this list of conditions and the following disclaimer in the
|
|
12
|
+
documentation and/or other materials provided with the distribution.
|
|
13
|
+
|
|
14
|
+
THIS SOFTWARE IS PROVIDED BY THE TEAM GPS ``AS IS'' AND ANY EXPRESS OR
|
|
15
|
+
IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
|
16
|
+
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
|
17
|
+
DISCLAIMED. IN NO EVENT SHALL THE TEAM GPS OR CONTRIBUTORS BE LIABLE
|
|
18
|
+
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
|
19
|
+
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
|
20
|
+
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
|
|
21
|
+
BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
|
22
|
+
WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
|
|
23
|
+
OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
|
|
24
|
+
IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
25
|
+
|
|
26
|
+
The views and conclusions contained in the software and documentation
|
|
27
|
+
are those of the authors and should not be interpreted as representing
|
|
28
|
+
official policies, either expressed or implied, of the Team GPS.
|
|
29
|
+
|
|
30
|
+
----------------------------------------------------------------------
|
|
31
|
+
Copyright (C) 2003-2014 Team GPS.
|
|
32
|
+
|
|
33
|
+
ソースコード形式であれバイナリ形式であれ、変更の有無に 関わらず、以下
|
|
34
|
+
の条件を満たす限りにおいて、再配布してかまいません:
|
|
35
|
+
|
|
36
|
+
ソースコード形式で再配布する場合、上記著作権表示、 本条件書および下記
|
|
37
|
+
責任限定規定を必ず含めてください。
|
|
38
|
+
|
|
39
|
+
バイナリ形式で再配布する場合、上記著作権表示、 本条件書および下記責任
|
|
40
|
+
限定規定を、配布物とともに提供される文書 および/または 他の資料に必ず
|
|
41
|
+
含めてください。
|
|
42
|
+
|
|
43
|
+
本ソフトウェアは Team GPS によって、”現状のまま” 提供されるものとし
|
|
44
|
+
ます。 本ソフトウェアについては、明示黙示を問わず、 商用品として通常そ
|
|
45
|
+
なえるべき品質をそなえているとの保証も、 特定の目的に適合するとの保証
|
|
46
|
+
を含め、何の保証もなされません。 事由のいかんを問わず、 損害発生の原因
|
|
47
|
+
いかんを問わず、且つ、 責任の根拠が契約であるか厳格責任であるか (過失
|
|
48
|
+
その他) 不法行為であるかを問わず、 Team GPS も寄与者も、 仮にそのよう
|
|
49
|
+
な損害が発生する可能性を知らされていたとしても、 本文書の使用から発生
|
|
50
|
+
した直接損害、間接損害、偶発的な損害、特別損害、 懲罰的損害または結果
|
|
51
|
+
損害のいずれに対しても (代替品または サービスの提供; 使用機会、データ
|
|
52
|
+
または利益の損失の補償; または、業務の中断に対する補償を含め) 責任をいっ
|
|
53
|
+
さい負いません。
|
|
54
|
+
|
|
55
|
+
このソフトウェアと文書に含まれる意見や結論はそれらの著作者による もの
|
|
56
|
+
であって、Team GPS の 公式な方針を、明示黙示を問わず、あらわしているも
|
|
57
|
+
のと とってはならない。
|
miniosl-0.0.3a1/PKG-INFO
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
Metadata-Version: 2.1
|
|
2
|
+
Name: miniosl
|
|
3
|
+
Version: 0.0.3a1
|
|
4
|
+
Summary: A python interface to miniosl (shogi library)
|
|
5
|
+
Author: Tomoyuki Kaneko
|
|
6
|
+
Author-email: kaneko@graco.c.u-tokyo.ac.jp
|
|
7
|
+
Project-URL: Source, https://github.com/tkaneko/miniosl
|
|
8
|
+
Requires-Python: >=3.10
|
|
9
|
+
Description-Content-Type: text/markdown
|
|
10
|
+
License-File: LICENSE.osl
|
|
11
|
+
License-File: AUTHORS.osl
|
|
12
|
+
|
|
13
|
+
# miniOSL
|
|
14
|
+
|
|
15
|
+
Python interface to [OSL (open shogi library)](https://gps.tanaka.ecc.u-tokyo.ac.jp/gpsshogi/index.php?GPSshogi) refurbished by C++20 and by pybind11.
|
|
16
|
+
|
|
17
|
+
WIP.
|
|
18
|
+
|
|
19
|
+
## demo@colab
|
|
20
|
+
|
|
21
|
+
https://colab.research.google.com/drive/1orT32kOR58owC0SfhPdC0yodFdn8h2nX?usp=share_link
|
|
22
|
+
|
|
23
|
+
## pip wheel
|
|
24
|
+
|
|
25
|
+
- https://pypi.org/project/miniosl/
|
|
26
|
+
|
|
27
|
+
## build from source
|
|
28
|
+
|
|
29
|
+
- C++20 (tested with g++ 12.2.1 in `manylinux_2_28`, Apple clang 14.0.3)
|
|
30
|
+
- Python 3.10+
|
|
31
|
+
- cmake 3.22+
|
|
32
|
+
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
# miniOSL
|
|
2
|
+
|
|
3
|
+
Python interface to [OSL (open shogi library)](https://gps.tanaka.ecc.u-tokyo.ac.jp/gpsshogi/index.php?GPSshogi) refurbished by C++20 and by pybind11.
|
|
4
|
+
|
|
5
|
+
WIP.
|
|
6
|
+
|
|
7
|
+
## demo@colab
|
|
8
|
+
|
|
9
|
+
https://colab.research.google.com/drive/1orT32kOR58owC0SfhPdC0yodFdn8h2nX?usp=share_link
|
|
10
|
+
|
|
11
|
+
## pip wheel
|
|
12
|
+
|
|
13
|
+
- https://pypi.org/project/miniosl/
|
|
14
|
+
|
|
15
|
+
## build from source
|
|
16
|
+
|
|
17
|
+
- C++20 (tested with g++ 12.2.1 in `manylinux_2_28`, Apple clang 14.0.3)
|
|
18
|
+
- Python 3.10+
|
|
19
|
+
- cmake 3.22+
|
|
20
|
+
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
from miniosl.state import State
|
|
2
|
+
from minioslcc import *
|
|
3
|
+
import miniosl.record
|
|
4
|
+
from miniosl.record import np_array_to_sfen_file, sfen_file_to_np_array
|
|
5
|
+
|
|
6
|
+
setattr(MiniRecord, 'replay', miniosl.record.minirecord_replay)
|
|
7
|
+
setattr(MiniRecord, 'to_apng', miniosl.record.minirecord_to_apng)
|
|
@@ -0,0 +1,178 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
import minioslcc
|
|
3
|
+
import drawsvg as dw
|
|
4
|
+
# import cairosvg
|
|
5
|
+
|
|
6
|
+
css = ".piece { font-family: Noto Serif CJK JP; }" # prevent from tofu in png
|
|
7
|
+
|
|
8
|
+
csadict = {
|
|
9
|
+
'FU': '歩', 'KY': '香', 'KE': '桂', 'GI': '銀', 'KI': '金', 'KA': '角', 'HI': '飛', 'OU': '王',
|
|
10
|
+
'TO': 'と', 'NY': '杏', 'NK': '圭', 'NG': '全', 'UM': '馬', 'RY': '龍',
|
|
11
|
+
}
|
|
12
|
+
kanjirow = [None, '一', '二', '三', '四', '五', '六', '七', '八', '九']
|
|
13
|
+
kanjicol = [None, '1', '2', '3', '4', '5', '6', '7', '8', '9']
|
|
14
|
+
|
|
15
|
+
no_pieces_in_hand = 'なし'
|
|
16
|
+
label_hand_b = '先手持駒'
|
|
17
|
+
label_hand_w = '後手持駒'
|
|
18
|
+
hand_others = '他'
|
|
19
|
+
|
|
20
|
+
char_property = {'class': "piece", 'fill': 'black'}
|
|
21
|
+
sub_property = {'class': "piece", 'fill': 'gray'}
|
|
22
|
+
b_property = {'fill': 'orange', 'fill_opacity': 0.2, 'stroke_width': 0}
|
|
23
|
+
w_property = {'fill': 'blue', 'fill_opacity': 0.2, 'stroke_width': 0}
|
|
24
|
+
c_property = {'fill': 'purple', 'fill_opacity': 0.2, 'stroke_width': 0}
|
|
25
|
+
in_check_property = {'fill': 'red', 'fill_opacity': 0.5, 'stroke_width': 0}
|
|
26
|
+
last_move_property = {'fill': 'yellow', 'fill_opacity': 0.2, 'stroke_width': 0}
|
|
27
|
+
scale = 20
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
def gx(x):
|
|
31
|
+
return (11-x)*scale+scale/2
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
def gy(y):
|
|
35
|
+
return (y+1)*scale
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
def radius(cnt):
|
|
39
|
+
return scale/4 * (cnt ** 1/4)
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
class ShogiSVG:
|
|
43
|
+
"""svg under drawing"""
|
|
44
|
+
|
|
45
|
+
def __init__(self, state: State):
|
|
46
|
+
self.state = state
|
|
47
|
+
self.d = dw.Drawing(scale*14.5, scale*11.5, id_prefix=str(id))
|
|
48
|
+
self.d.append_css(css)
|
|
49
|
+
|
|
50
|
+
def add(self, element) -> None:
|
|
51
|
+
self.d.append(element)
|
|
52
|
+
|
|
53
|
+
def _decorate_king(self, player: minioslcc.Player) -> None:
|
|
54
|
+
prop = b_property if player == minioslcc.black else w_property
|
|
55
|
+
if self.state.turn() == player and self.state.in_check():
|
|
56
|
+
prop = in_check_property
|
|
57
|
+
else:
|
|
58
|
+
prop = prop.copy()
|
|
59
|
+
prop['fill_opacity'] = 0.1
|
|
60
|
+
x, y = self.state.king_square(player).to_xy()
|
|
61
|
+
self.add(dw.Rectangle(gx(x), gy(y-1), scale, scale, **prop))
|
|
62
|
+
|
|
63
|
+
def decorate(self):
|
|
64
|
+
self._decorate_king(minioslcc.black)
|
|
65
|
+
self._decorate_king(minioslcc.white)
|
|
66
|
+
for x in range(1, 10):
|
|
67
|
+
for y in range(1, 10):
|
|
68
|
+
eb = self.state.count_cover(minioslcc.black, minioslcc.Square(x, y))
|
|
69
|
+
ew = self.state.count_cover(minioslcc.white, minioslcc.Square(x, y))
|
|
70
|
+
if eb > 0 and ew > 0:
|
|
71
|
+
self.add(dw.Circle(gx(x-.5), gy(y-.5), radius(eb+ew), **c_property))
|
|
72
|
+
elif eb > 0:
|
|
73
|
+
self.add(dw.Circle(gx(x-.5), gy(y-.5), radius(eb), **b_property))
|
|
74
|
+
elif ew > 0:
|
|
75
|
+
self.add(dw.Circle(gx(x-.5), gy(y-.5), radius(ew), **w_property))
|
|
76
|
+
|
|
77
|
+
def draw_piece(self, x, y):
|
|
78
|
+
piece = self.state.piece_at(minioslcc.Square(x, y))
|
|
79
|
+
if not piece.is_piece():
|
|
80
|
+
return
|
|
81
|
+
kanji = csadict[minioslcc.to_csa(piece.ptype())]
|
|
82
|
+
if piece.color() == minioslcc.black:
|
|
83
|
+
self.add(dw.Text(kanji, font_size=scale*.875, x=gx(x)+scale*.05, y=gy(y)-scale*.125,
|
|
84
|
+
**char_property))
|
|
85
|
+
else:
|
|
86
|
+
assert piece.color() == minioslcc.white
|
|
87
|
+
self.add(dw.Text(kanji, font_size=scale*.875, x=gx(x)+scale*.9, y=gy(y)-scale*.8,
|
|
88
|
+
rotate='180', **char_property))
|
|
89
|
+
|
|
90
|
+
def draw_grid(self):
|
|
91
|
+
for i in range(1, 10):
|
|
92
|
+
self.add(dw.Text(kanjicol[i], font_size=scale*.75, x=gx(i)+scale*.25, y=gy(0)-scale*0.25,
|
|
93
|
+
**sub_property))
|
|
94
|
+
self.add(dw.Text(kanjirow[i], font_size=scale*.625, x=gx(0)+scale/4, y=gy(i)-scale*0.25,
|
|
95
|
+
**sub_property))
|
|
96
|
+
if i < 9:
|
|
97
|
+
self.add(dw.Line(gx(0), gy(i), gx(9), gy(i), stroke='gray'))
|
|
98
|
+
self.add(dw.Line(gx(i), gy(0), gx(i), gy(9), stroke='gray'))
|
|
99
|
+
self.add(dw.Line(gx(0), gy(0), gx(9), gy(0), stroke='black'))
|
|
100
|
+
self.add(dw.Line(gx(0), gy(9), gx(9), gy(9), stroke='black'))
|
|
101
|
+
self.add(dw.Line(gx(0), gy(0), gx(0), gy(9), stroke='black'))
|
|
102
|
+
self.add(dw.Line(gx(9), gy(0), gx(9), gy(9), stroke='black'))
|
|
103
|
+
|
|
104
|
+
def show_side_to_move(self):
|
|
105
|
+
player_to_move = "先手" if self.state.turn() == minioslcc.black else "後手"
|
|
106
|
+
self.add(dw.Text('手番 '+player_to_move, font_size=scale*.75, x=gx(9)+scale*.05, y=gy(10),
|
|
107
|
+
**char_property))
|
|
108
|
+
if self.state.last_move_ja:
|
|
109
|
+
self.add(dw.Text('('+self.state.last_move_ja + ' まで)', font_size=scale*.7,
|
|
110
|
+
x=gx(5)+scale*.05, y=gy(10), **sub_property))
|
|
111
|
+
|
|
112
|
+
def hand_pieces_str(self, player: minioslcc.Player) -> str:
|
|
113
|
+
ret = ''
|
|
114
|
+
for ptype in minioslcc.piece_stand_order:
|
|
115
|
+
cnt = self.state.count_hand(player, ptype)
|
|
116
|
+
if cnt == 0:
|
|
117
|
+
continue
|
|
118
|
+
ret += csadict[minioslcc.to_csa(ptype)] * cnt
|
|
119
|
+
return ret
|
|
120
|
+
|
|
121
|
+
def show_hand(self):
|
|
122
|
+
# i: [0,4] label+space
|
|
123
|
+
hand_b = self.hand_pieces_str(minioslcc.black)
|
|
124
|
+
hand_w = self.hand_pieces_str(minioslcc.white)
|
|
125
|
+
prop = sub_property.copy()
|
|
126
|
+
prop['font_size'] = scale*.75
|
|
127
|
+
for i in range(len(label_hand_b)):
|
|
128
|
+
self.add(dw.Text(label_hand_b[i], x=gx(-2)+scale*.05, y=gy(i*0.8),
|
|
129
|
+
**prop))
|
|
130
|
+
self.add(dw.Text(label_hand_w[i], x=gx(11)+scale*.5, y=gy(8.4-i*0.8),
|
|
131
|
+
rotate=180, **prop))
|
|
132
|
+
if not hand_b:
|
|
133
|
+
for i, c in enumerate(no_pieces_in_hand):
|
|
134
|
+
self.add(dw.Text(c, x=gx(-2)+scale*.05, y=gy((i+5)*0.8),
|
|
135
|
+
**prop))
|
|
136
|
+
if not hand_w:
|
|
137
|
+
for i, c in enumerate(no_pieces_in_hand):
|
|
138
|
+
self.add(dw.Text(c, x=gx(11)+scale*.5, y=gy(8.4-(i+5)*0.8),
|
|
139
|
+
rotate=180, **prop))
|
|
140
|
+
|
|
141
|
+
prop = char_property.copy()
|
|
142
|
+
prop['font_size'] = scale*.75
|
|
143
|
+
for i in range(min(7, len(hand_b))):
|
|
144
|
+
self.add(dw.Text(hand_b[i], x=gx(-2)+scale*.05, y=gy((i+5)*0.8),
|
|
145
|
+
**prop))
|
|
146
|
+
for i in range(7, min(14, len(hand_b))):
|
|
147
|
+
self.add(dw.Text(hand_b[i], x=gx(-1.2)+scale*.05, y=gy((i-2)*0.8),
|
|
148
|
+
**prop))
|
|
149
|
+
if len(hand_b) >= 14:
|
|
150
|
+
self.add(dw.Text(hand_others, x=gx(-0.35), y=gy(5*0.8), **prop))
|
|
151
|
+
for i in range(min(7, len(hand_w))):
|
|
152
|
+
self.add(dw.Text(hand_w[i], x=gx(11)+scale*.5, y=gy(8.4-(i+5)*0.8),
|
|
153
|
+
rotate=180, **prop))
|
|
154
|
+
for i in range(7, min(14, len(hand_w))):
|
|
155
|
+
self.add(dw.Text(hand_w[i], x=gx(10.2)+scale*.5, y=gy(8.4-(i-2)*0.8),
|
|
156
|
+
rotate=180, **prop))
|
|
157
|
+
if len(hand_w) >= 14:
|
|
158
|
+
self.add(dw.Text(hand_others, x=gx(9.9), y=gy(5*0.8), **prop))
|
|
159
|
+
|
|
160
|
+
|
|
161
|
+
def csaboard_to_svg(state: State, id: int, *, decorate=False) -> drawsvg.drawing.Drawing:
|
|
162
|
+
svg = ShogiSVG(state)
|
|
163
|
+
if decorate:
|
|
164
|
+
svg.decorate()
|
|
165
|
+
|
|
166
|
+
if last_to := state.last_to():
|
|
167
|
+
x, y = last_to.to_xy()
|
|
168
|
+
svg.add(dw.Rectangle(gx(x), gy(y-1), scale, scale, **last_move_property))
|
|
169
|
+
|
|
170
|
+
for x in range(1, 10):
|
|
171
|
+
for y in range(1, 10):
|
|
172
|
+
svg.draw_piece(x, y)
|
|
173
|
+
|
|
174
|
+
svg.draw_grid()
|
|
175
|
+
svg.show_side_to_move()
|
|
176
|
+
svg.show_hand()
|
|
177
|
+
|
|
178
|
+
return svg.d
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
import minioslcc
|
|
3
|
+
import miniosl.state
|
|
4
|
+
import apng
|
|
5
|
+
import base64
|
|
6
|
+
import numpy as np
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
def minirecord_replay(self: minioslcc.MiniRecord, n: int) -> State:
|
|
10
|
+
if n < 0:
|
|
11
|
+
n = len(self.moves) - n
|
|
12
|
+
s = miniosl.state.State(self.initial_state)
|
|
13
|
+
for i, move in enumerate(self.moves):
|
|
14
|
+
if i >= n:
|
|
15
|
+
break
|
|
16
|
+
s.make_move(move)
|
|
17
|
+
return s
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
def state_to_png(state: State, decorate: bool) -> apng.PNG:
|
|
21
|
+
b64png = state.to_png(decorate=decorate).as_data_uri()
|
|
22
|
+
bytes = b64png[len('data:image/png;base64,'):]
|
|
23
|
+
return apng.PNG.from_bytes(base64.b64decode(bytes.encode('utf-8')))
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
def minirecord_to_apng(self: minioslcc.MiniRecord,
|
|
27
|
+
n: int = 0, start: int = 0, delay: int = 1000,
|
|
28
|
+
decorate: bool = False) -> apng.APNG:
|
|
29
|
+
im = apng.APNG(1)
|
|
30
|
+
s = miniosl.state.State(self.initial_state)
|
|
31
|
+
if start <= 0:
|
|
32
|
+
im.append(state_to_png(s, decorate), delay=delay)
|
|
33
|
+
for i, move in enumerate(self.moves):
|
|
34
|
+
s.make_move(move)
|
|
35
|
+
if start < i+1:
|
|
36
|
+
im.append(state_to_png(s, decorate), delay=delay)
|
|
37
|
+
if n > 0 and i >= start+n:
|
|
38
|
+
break
|
|
39
|
+
return im
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
def sfen_file_to_np_array(filename: str) -> np.ndarray:
|
|
43
|
+
data = []
|
|
44
|
+
with open(filename, 'r') as f:
|
|
45
|
+
for line in f:
|
|
46
|
+
line = line.strip()
|
|
47
|
+
record = miniosl.usi_record(line)
|
|
48
|
+
data += record.pack_record()
|
|
49
|
+
return np.array(data, dtype=np.uint64)
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
def np_array_to_sfen_file(data: np.ndarray, filename: str) -> None:
|
|
53
|
+
count = 0
|
|
54
|
+
with open(filename, 'w') as f:
|
|
55
|
+
while True:
|
|
56
|
+
record, n = miniosl.unpack_record(data[count:])
|
|
57
|
+
f.write(record.to_usi()+'\n')
|
|
58
|
+
count += n
|
|
59
|
+
if count >= len(data) or n == 0:
|
|
60
|
+
break
|
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
import minioslcc
|
|
3
|
+
import miniosl.drawing
|
|
4
|
+
import random
|
|
5
|
+
import numpy as np
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
def is_in_notebook() -> bool:
|
|
9
|
+
"""detect run in ipython notebook"""
|
|
10
|
+
# https://stackoverflow.com/questions/15411967/
|
|
11
|
+
try:
|
|
12
|
+
shell = get_ipython().__class__
|
|
13
|
+
if 'google.colab' in str(shell):
|
|
14
|
+
return True
|
|
15
|
+
shell = shell.__name__
|
|
16
|
+
if shell == 'ZMQInteractiveShell':
|
|
17
|
+
return True # Jupyter notebook or qtconsole
|
|
18
|
+
elif shell == 'TerminalInteractiveShell':
|
|
19
|
+
return False # Terminal running IPython
|
|
20
|
+
else:
|
|
21
|
+
return False # Other type (?)
|
|
22
|
+
except NameError:
|
|
23
|
+
return False # Probably standard Python interpreter
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
class State(minioslcc.CCState):
|
|
27
|
+
"""
|
|
28
|
+
shogi state = board position + pieces in hand (mochigoma),
|
|
29
|
+
enhanced with move history
|
|
30
|
+
"""
|
|
31
|
+
prefer_svg = False # shared preference on board representation
|
|
32
|
+
prefer_png = False
|
|
33
|
+
|
|
34
|
+
def __init__(self, init='', *, prefer_png=False, prefer_svg=False):
|
|
35
|
+
super().__init__()
|
|
36
|
+
self.history = []
|
|
37
|
+
self.last_move_ja = None
|
|
38
|
+
self.id = random.randrange(2**20)
|
|
39
|
+
if not State.prefer_svg:
|
|
40
|
+
State.prefer_svg = prefer_svg or is_in_notebook()
|
|
41
|
+
if not State.prefer_png:
|
|
42
|
+
State.prefer_png = prefer_png
|
|
43
|
+
self.default_format = 'usi'
|
|
44
|
+
if init == '':
|
|
45
|
+
pass # default
|
|
46
|
+
elif isinstance(init, str) and len(init) >= 8:
|
|
47
|
+
if init[:2] == 'P1':
|
|
48
|
+
super().reset(minioslcc.csa_board(init))
|
|
49
|
+
elif init[0] == 's':
|
|
50
|
+
super().reset(minioslcc.usi_board(init))
|
|
51
|
+
else:
|
|
52
|
+
raise ValueError(init+' not expected')
|
|
53
|
+
elif isinstance(init, minioslcc.MiniRecord):
|
|
54
|
+
super().reset(init.initial_state)
|
|
55
|
+
self.history = init.moves
|
|
56
|
+
self.initial_state = self.to_usi()
|
|
57
|
+
self._replay()
|
|
58
|
+
|
|
59
|
+
def reset(self, src):
|
|
60
|
+
super().reset(src)
|
|
61
|
+
self.history = []
|
|
62
|
+
self.last_move_ja = None
|
|
63
|
+
self.initial_state = self.to_usi()
|
|
64
|
+
|
|
65
|
+
def __repr__(self) -> str:
|
|
66
|
+
return "<State '" + self.to_usi() + "'>"
|
|
67
|
+
|
|
68
|
+
def __str__(self):
|
|
69
|
+
return self.to_csa() if self.default_format == 'csa' else self.to_usi()
|
|
70
|
+
|
|
71
|
+
def to_svg(self, *, decorate=False) -> drawsvg.drawing.Drawing:
|
|
72
|
+
return miniosl.drawing.csaboard_to_svg(self, self.id, decorate=decorate)
|
|
73
|
+
|
|
74
|
+
def to_png(self, *, decorate=False) -> drawsvg.raster.Raster:
|
|
75
|
+
return self.to_svg(decorate=decorate).rasterize()
|
|
76
|
+
|
|
77
|
+
def hint(self):
|
|
78
|
+
if State.prefer_png:
|
|
79
|
+
return self.to_png()
|
|
80
|
+
return self.to_svg() if State.prefer_svg else self.to_csa()
|
|
81
|
+
|
|
82
|
+
def make_move(self, move):
|
|
83
|
+
if isinstance(move, str):
|
|
84
|
+
copy = move
|
|
85
|
+
move = self.to_move(move)
|
|
86
|
+
if not move.is_normal():
|
|
87
|
+
raise ValueError('please check syntax '+copy)
|
|
88
|
+
if not super().is_legal(move):
|
|
89
|
+
raise ValueError('illegal move '+str(move))
|
|
90
|
+
self.last_move_ja = self.move_to_ja(move) # need here before make_move
|
|
91
|
+
super().make_move(move)
|
|
92
|
+
|
|
93
|
+
self.history.append(move)
|
|
94
|
+
return self.hint()
|
|
95
|
+
|
|
96
|
+
def unmake_move(self):
|
|
97
|
+
if len(self.history) < 1:
|
|
98
|
+
raise ValueError('history empty')
|
|
99
|
+
self.history.pop()
|
|
100
|
+
self._replay()
|
|
101
|
+
return self.hint()
|
|
102
|
+
|
|
103
|
+
def move_to_ja(self, move: minioslcc.Move) -> str:
|
|
104
|
+
last_to = self.last_to()
|
|
105
|
+
return minioslcc.to_ja(move, self, last_to) if last_to else minioslcc.to_ja(move, self)
|
|
106
|
+
|
|
107
|
+
def genmove_ja(self) -> list:
|
|
108
|
+
return [self.move_to_ja(move) for move in self.genmove()]
|
|
109
|
+
|
|
110
|
+
def last_move(self) -> minioslcc.Move:
|
|
111
|
+
return self.history[-1] if len(self.history) > 0 else None
|
|
112
|
+
|
|
113
|
+
def last_to(self) -> minioslcc.Square:
|
|
114
|
+
move = self.last_move()
|
|
115
|
+
return move.dst() if move else None
|
|
116
|
+
|
|
117
|
+
def clone(self) -> State:
|
|
118
|
+
return State(self.to_usi())
|
|
119
|
+
|
|
120
|
+
def to_np(self) -> np.array:
|
|
121
|
+
return super().to_np().reshape(9, 9)
|
|
122
|
+
|
|
123
|
+
def to_np_hand(self) -> np.array:
|
|
124
|
+
return super().to_np_hand().reshape(2, 7)
|
|
125
|
+
|
|
126
|
+
def to_np_cover(self) -> np.array:
|
|
127
|
+
return super().to_np_cover().reshape(2, 9, 9)
|
|
128
|
+
|
|
129
|
+
def _replay(self):
|
|
130
|
+
if self.to_usi() != self.initial_state:
|
|
131
|
+
super().reset(minioslcc.usi_board(self.initial_state))
|
|
132
|
+
if len(self.history) == 0:
|
|
133
|
+
return
|
|
134
|
+
self.last_move_ja = None
|
|
135
|
+
for i, move in enumerate(self.history):
|
|
136
|
+
if i == len(self.history)-2: # just before last make_move
|
|
137
|
+
if i > 0:
|
|
138
|
+
self.last_move_ja = minioslcc.move_to_ja
|
|
139
|
+
(self, move, self.history[i-1].to())
|
|
140
|
+
else:
|
|
141
|
+
self.last_move_ja = minioslcc.move_to_ja(self, move)
|
|
142
|
+
super().make_move(move)
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
Metadata-Version: 2.1
|
|
2
|
+
Name: miniosl
|
|
3
|
+
Version: 0.0.3a1
|
|
4
|
+
Summary: A python interface to miniosl (shogi library)
|
|
5
|
+
Author: Tomoyuki Kaneko
|
|
6
|
+
Author-email: kaneko@graco.c.u-tokyo.ac.jp
|
|
7
|
+
Project-URL: Source, https://github.com/tkaneko/miniosl
|
|
8
|
+
Requires-Python: >=3.10
|
|
9
|
+
Description-Content-Type: text/markdown
|
|
10
|
+
License-File: LICENSE.osl
|
|
11
|
+
License-File: AUTHORS.osl
|
|
12
|
+
|
|
13
|
+
# miniOSL
|
|
14
|
+
|
|
15
|
+
Python interface to [OSL (open shogi library)](https://gps.tanaka.ecc.u-tokyo.ac.jp/gpsshogi/index.php?GPSshogi) refurbished by C++20 and by pybind11.
|
|
16
|
+
|
|
17
|
+
WIP.
|
|
18
|
+
|
|
19
|
+
## demo@colab
|
|
20
|
+
|
|
21
|
+
https://colab.research.google.com/drive/1orT32kOR58owC0SfhPdC0yodFdn8h2nX?usp=share_link
|
|
22
|
+
|
|
23
|
+
## pip wheel
|
|
24
|
+
|
|
25
|
+
- https://pypi.org/project/miniosl/
|
|
26
|
+
|
|
27
|
+
## build from source
|
|
28
|
+
|
|
29
|
+
- C++20 (tested with g++ 12.2.1 in `manylinux_2_28`, Apple clang 14.0.3)
|
|
30
|
+
- Python 3.10+
|
|
31
|
+
- cmake 3.22+
|
|
32
|
+
|