cn
This commit is contained in:
1 parent
706c7416b9
commit
7c2bd0759a
9 files changed
+15
-114
No files matched your search
-85
@@ -1,85 +0,0 @@
|
||||
import math
|
||||
|
||||
import kivy
|
||||
from kivy.app import App
|
||||
from kivy.core.image import Texture
|
||||
from kivy.factory import Factory
|
||||
from kivy.graphics.vertex_instructions import Ellipse
|
||||
from kivy.lang import Builder
|
||||
from kivy.properties import NumericProperty, ObjectProperty
|
||||
from kivy.uix.label import Label
|
||||
from kivy.uix.widget import Widget
|
||||
|
||||
|
||||
class MyWidget(Widget):
|
||||
pass
|
||||
|
||||
|
||||
class MyTexture(Widget):
|
||||
radius = NumericProperty(100)
|
||||
texture = ObjectProperty(None, allownone=True)
|
||||
|
||||
# @staticmethod
|
||||
# def generate_texture():
|
||||
|
||||
def __init__(self, **kwargs):
|
||||
super().__init__(**kwargs)
|
||||
self.bind(size=self.redraw)
|
||||
self.cbuffer = None
|
||||
self.redraw()
|
||||
|
||||
@staticmethod
|
||||
def draw_circle(height, width):
|
||||
|
||||
r = min(height / 2, width / 2) - 5
|
||||
center = r
|
||||
|
||||
arr = [[[0, 1, 0, 1] for _ in range(height)] for _ in range(width)]
|
||||
n = 1000
|
||||
for i in range(n):
|
||||
dr = 2 * math.pi * i / n
|
||||
x, y = round(center + r * math.cos(dr)), round(center + r * math.sin(dr))
|
||||
arr[y][x] = [1, 0, 0, 1]
|
||||
l = sum([sum(r, []) for r in arr], [])
|
||||
return "".join(chr(round(a*255)) for a in l).encode()
|
||||
|
||||
def redraw(self, *args):
|
||||
width, height = self.size
|
||||
self.cbuffer = self.draw_circle(width, height) # b"\xff\x66\x99\xff" * width * height
|
||||
self.texture = Texture.create(size=(width, height), colorfmt="rgba", bufferfmt="ubyte")
|
||||
self.texture.add_reload_observer(self.populate_texture)
|
||||
self.populate_texture(self.texture)
|
||||
|
||||
def populate_texture(self, texture):
|
||||
texture.blit_buffer(self.cbuffer, colorfmt="rgba", bufferfmt="ubyte")
|
||||
|
||||
|
||||
KV = """
|
||||
|
||||
<MyTexture>:
|
||||
canvas.before:
|
||||
Rectangle:
|
||||
pos: root.pos
|
||||
texture: root.texture
|
||||
|
||||
<MyWidget>:
|
||||
canvas:
|
||||
Color:
|
||||
rgba: (1,0,0,1)
|
||||
Ellipse:
|
||||
pos: 100,100
|
||||
size: 50,50
|
||||
MyTexture:
|
||||
pos: 300,300
|
||||
size: 100,200
|
||||
"""
|
||||
Builder.load_string(KV)
|
||||
|
||||
|
||||
class MyApp(App):
|
||||
def build(self):
|
||||
return MyWidget()
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
MyApp().run()
|
||||
Binary file not shown.
@@ -557,51 +557,37 @@ msgid "Starting Kata failed"
|
||||
msgstr ""
|
||||
"用'{command}'命令启动katago出错 {error}. 请确认引擎设置里'katago'的值指向了 正确的KataGo运行文件."
|
||||
|
||||
#. TODO - shown on on the model select dropdown
|
||||
msgid "models available"
|
||||
msgstr "{num} available model(s) found"
|
||||
msgstr "找到{num} 个可用模型"
|
||||
|
||||
#. TODO - button in general settings for downloading models
|
||||
msgid "download models button"
|
||||
msgstr "Download Models"
|
||||
msgstr "下载模型"
|
||||
|
||||
#. TODO - error message on trying to download models when already done
|
||||
msgid "All models downloaded"
|
||||
msgstr "All available models already downloaded"
|
||||
msgstr "所有可用模型均已下载"
|
||||
|
||||
#. TODO - shown on a graph tab
|
||||
msgid "tab:rank_est"
|
||||
msgstr "Rank Estimate"
|
||||
msgstr "估计段位"
|
||||
|
||||
#. TODO - status message
|
||||
msgid "game re-analysis"
|
||||
msgstr "Re-analyzing entire game using {visits} visits"
|
||||
msgstr "使用 {visits}深度全局再分析"
|
||||
|
||||
#. TODO - Analyze every node in the game more deeply
|
||||
msgid "analysis:game"
|
||||
msgstr "Deeper full game analysis"
|
||||
msgstr "深入全盘分析"
|
||||
|
||||
#. TODO - Keep improving current position analysis when there is nothing else
|
||||
#. to do
|
||||
msgid "analysis:continuous"
|
||||
msgstr "Continuously analyze"
|
||||
msgstr "开启继续分析"
|
||||
|
||||
#. TODO - ai which handles handicap games better
|
||||
msgid "ai:handicap"
|
||||
msgstr "KataHandicap"
|
||||
msgstr "Kata让子棋"
|
||||
|
||||
#. TODO
|
||||
msgid "aihelp:handicap"
|
||||
msgstr ""
|
||||
"KataGo optimized for playing higher handicap games.The `pda` setting "
|
||||
"corresponds to `playoutDoublingAdvantage` in KataGo, from black's "
|
||||
"perspective. When `automatic` is set, KaTrain will find a suitable value "
|
||||
"automatically."
|
||||
"KataGo 让子棋优化版. pda 设置 对应KataGo里黑棋视角的 playoutDoublingAdvantage. 当设置了 自动, "
|
||||
"KaTrain 会自动找到合适的值"
|
||||
|
||||
#. TODO - in AI settings
|
||||
msgid "estimated strength"
|
||||
msgstr "Estimated Strength"
|
||||
msgstr "预计棋力"
|
||||
|
||||
#. TODO - label in little popup for analyzing entire game
|
||||
msgid "reanalyze max visits"
|
||||
msgstr "Number of visits per move"
|
||||
msgstr "每步棋计算深度"
|
||||
Binary file not shown.
@@ -104,7 +104,7 @@ msgstr "Deeper full game analysis"
|
||||
|
||||
#. Keep improving current position analysis when there is nothing else to do
|
||||
msgid "analysis:continuous"
|
||||
msgstr "Continuous analysis"
|
||||
msgstr "Toggle continuous analysis"
|
||||
|
||||
msgid "analysis:aimove"
|
||||
msgstr "Force AI Move"
|
||||
|
||||
Binary file not shown.
@@ -661,7 +661,7 @@ msgstr "Deeper full game analysis"
|
||||
#. TODO - Keep improving current position analysis when there is nothing else
|
||||
#. to do
|
||||
msgid "analysis:continuous"
|
||||
msgstr "Continuous analysis"
|
||||
msgstr "Toggle continuous analysis"
|
||||
|
||||
#. TODO - ai which handles handicap games better
|
||||
msgid "ai:handicap"
|
||||
|
||||
Binary file not shown.
@@ -591,7 +591,7 @@ msgid "analysis:game"
|
||||
msgstr "대국 전체를 다시 분석하기"
|
||||
|
||||
msgid "analysis:continuous"
|
||||
msgstr "분석 계속하기"
|
||||
msgstr "분석 계속하기/멈추기"
|
||||
|
||||
msgid "ai:handicap"
|
||||
msgstr "접바둑 KataGo"
|
||||
|
||||
Reference in new issue
Block a user