
【遊戯王MD】遊戯王に勝率を表示したい
遊戯王MDカジュアル鯖管理人のリュウジです。
遊戯王WCS2024年全試合見ましたが、見応えのある試合もあり、たまにはガチ試合を見るのは良いと思いました。
さて、プレイヤーの中にはこの世界大会対戦をどう見ればいいかわからない、効果処理多すぎて結局どっちが有利な状況か分からないという方もいると思います。
まだ将棋やポケモンのように評価値バーがまだない。
そこで、評価値バーをトップ画像のように表示できるようにしました。
こちらの元々が将棋に入れる前提ではあったので、
変えたものが以下となります。
(Python 3.12.3にて動作確認実施済)
import numpy as np
import tkinter as tk
#エンジン名・フォント・文字色・背景色
engine = "水匠5" # 水匠5
barfont = "BIZ UDGothic" # BIZ UDGothic
bgcolor = "white" # white
fgcolor = "black" # black
turnfgcolor = "#00007f" # #00007f
leftgraphbg = "#aa0000" # #red
rightgraphbg = '#00008b' # #blue
blue = 50
red = 50
def output():
#Tkinter表示
root = tk.Tk()
root.geometry("1100x400")
root.minsize(width=1100, height=80)
root.title("評価値バー")
root.configure(bg = bgcolor)
#勝率ラベル
lwinratelabel = tk.Label(root, text=str(red)+"%", font=(barfont, 25), bg=bgcolor, fg=fgcolor)
lwinratelabel.place(x = 50, y = 20, anchor=tk.W)
rwinratelabel = tk.Label(root, text=str(blue)+"%", font=(barfont, 25), bg=bgcolor, fg=fgcolor)
rwinratelabel.place(x = 1050, y = 20, anchor=tk.E)
#勝率目盛り
label50 = tk.Label(root, text="", bg="black")
label50.place(x=547, y=35, width=3, height=30)
#評価値バー描画
rightgraph = tk.Label(root, text="", bg=rightgraphbg, relief=tk.SOLID, bd=3)
rightgraph.place(x=50, y=40, width=1000, height=20)
leftgraph = tk.Label(root, text="", bg=leftgraphbg, relief=tk.SOLID, bd=3)
leftgraph.place(x = 50, y = 40, width = int(red)*10, height = 20)
button = tk.Button(text="Click and Quit", command=root.destroy)
button.place(x=300, y=300, width=100, height=20)
root.mainloop()
#描画領域、優勢率を変更
def shoritu():
global blue
global red
blue = 100-int(red)
output()
while True:
red = input("数値を入力してください: ")
shoritu()
トップ画面では隠れていますが、

Click and Quit ボタンで、この画面を閉じ、閉じたらサイド評価値バーの表示を数値入力によって変えられるようにした。
実際に数値をつけて見たのがこちらになります。
間違えなく、僕よりも詳しい方はいるので、間違っている可能性の方が高いですが、詳しい人とどれだけ差が出るかを知りたいと思っており、
たくさんのご意見頂ければと考えています。
皆さんも是非、評価値バーを使ってどちらが優勢だったか教えてくださいね👍
いいなと思ったら応援しよう!
