-
-
Notifications
You must be signed in to change notification settings - Fork 404
/
rubiks.py
180 lines (141 loc) · 5.14 KB
/
rubiks.py
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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
# sage_setup: distribution = sagemath-environment
r"""
Features for testing the presence of ``rubiks``
"""
# ****************************************************************************
# Copyright (C) 2020 John H. Palmieri
# 2021-2022 Matthias Koeppe
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 2 of the License, or
# (at your option) any later version.
# https://www.gnu.org/licenses/
# ****************************************************************************
from sage.env import RUBIKS_BINS_PREFIX
from . import Executable
from .join_feature import JoinFeature
class cu2(Executable):
r"""
A :class:`~sage.features.Feature` describing the presence of ``cu2``.
EXAMPLES::
sage: from sage.features.rubiks import cu2
sage: cu2().is_present() # optional - rubiks
FeatureTestResult('cu2', True)
"""
def __init__(self):
r"""
TESTS::
sage: from sage.features.rubiks import cu2
sage: isinstance(cu2(), cu2)
True
"""
Executable.__init__(self, "cu2", executable=RUBIKS_BINS_PREFIX + "cu2",
spkg="rubiks")
class size222(Executable):
r"""
A :class:`~sage.features.Feature` describing the presence of ``size222``.
EXAMPLES::
sage: from sage.features.rubiks import size222
sage: size222().is_present() # optional - rubiks
FeatureTestResult('size222', True)
"""
def __init__(self):
r"""
TESTS::
sage: from sage.features.rubiks import size222
sage: isinstance(size222(), size222)
True
"""
Executable.__init__(self, "size222", executable=RUBIKS_BINS_PREFIX + "size222",
spkg="rubiks")
class optimal(Executable):
r"""
A :class:`~sage.features.Feature` describing the presence of ``optimal``.
EXAMPLES::
sage: from sage.features.rubiks import optimal
sage: optimal().is_present() # optional - rubiks
FeatureTestResult('optimal', True)
"""
def __init__(self):
r"""
TESTS::
sage: from sage.features.rubiks import optimal
sage: isinstance(optimal(), optimal)
True
"""
Executable.__init__(self, "optimal", executable=RUBIKS_BINS_PREFIX + "optimal",
spkg="rubiks")
class mcube(Executable):
r"""
A :class:`~sage.features.Feature` describing the presence of ``mcube``.
EXAMPLES::
sage: from sage.features.rubiks import mcube
sage: mcube().is_present() # optional - rubiks
FeatureTestResult('mcube', True)
"""
def __init__(self):
r"""
TESTS::
sage: from sage.features.rubiks import mcube
sage: isinstance(mcube(), mcube)
True
"""
Executable.__init__(self, "mcube", executable=RUBIKS_BINS_PREFIX + "mcube",
spkg="rubiks")
class dikcube(Executable):
r"""
A :class:`~sage.features.Feature` describing the presence of ``dikcube``.
EXAMPLES::
sage: from sage.features.rubiks import dikcube
sage: dikcube().is_present() # optional - rubiks
FeatureTestResult('dikcube', True)
"""
def __init__(self):
r"""
TESTS::
sage: from sage.features.rubiks import dikcube
sage: isinstance(dikcube(), dikcube)
True
"""
Executable.__init__(self, "dikcube", executable=RUBIKS_BINS_PREFIX + "dikcube",
spkg="rubiks")
class cubex(Executable):
r"""
A :class:`~sage.features.Feature` describing the presence of ``cubex``.
EXAMPLES::
sage: from sage.features.rubiks import cubex
sage: cubex().is_present() # optional - rubiks
FeatureTestResult('cubex', True)
"""
def __init__(self):
r"""
TESTS::
sage: from sage.features.rubiks import cubex
sage: isinstance(cubex(), cubex)
True
"""
Executable.__init__(self, "cubex", executable=RUBIKS_BINS_PREFIX + "cubex",
spkg="rubiks")
class Rubiks(JoinFeature):
r"""
A :class:`~sage.features.Feature` describing the presence of the
:class:`cu2`, :class:`cubex`, :class:`dikcube`, :class:`mcube`, :class:`optimal`, and
:class:`size222` programs from the :ref:`rubiks <spkg_rubiks>` package.
EXAMPLES::
sage: from sage.features.rubiks import Rubiks
sage: Rubiks().is_present() # optional - rubiks
FeatureTestResult('rubiks', True)
"""
def __init__(self):
r"""
TESTS::
sage: from sage.features.rubiks import Rubiks
sage: isinstance(Rubiks(), Rubiks)
True
"""
JoinFeature.__init__(self, "rubiks",
[cu2(), size222(), optimal(), mcube(), dikcube(), cubex()],
spkg="rubiks")
def all_features():
return [Rubiks()]