Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 21 additions & 15 deletions solver-bot/src/main/python/languages.json
Original file line number Diff line number Diff line change
Expand Up @@ -54,11 +54,13 @@
"error_displaying_application": "Error displaying task details.",
"cancel": "Actions canceled.",

"method_euler": "Euler's Method",
"method_midpoint": "Midpoint Method",
"method_heun": "Heun's Method",
"method_runge_kutta": "Runge-Kutta Method",
"method_dormand_prince": "Dormand-Prince Method",
"numerical_methods": {
"euler": "Euler's Method",
"midpoint": "Midpoint Method",
"heun": "Heun's Method",
"runge_kutta": "Runge-Kutta Method",
"dormand_prince": "Dormand-Prince Method"
},

"method": "Method",
"equation": "Equation",
Expand Down Expand Up @@ -123,11 +125,13 @@
"error_displaying_application": "Ошибка при отображении деталей задачи.",
"cancel": "Действия отменены.",

"method_euler": "Метод Эйлера",
"method_midpoint": "Метод Средней Точки",
"method_heun": "Метод Хойна",
"method_runge_kutta": "Метод Рунге-Кутта",
"method_dormand_prince": "Метод Дормана-Принса",
"numerical_methods": {
"euler": "Метод Эйлера",
"midpoint": "Метод Средней Точки",
"heun": "Метод Хойна",
"runge_kutta": "Метод Рунге-Кутта",
"dormand_prince": "Метод Дормана-Принса"
},

"method": "Метод",
"equation": "Уравнение",
Expand Down Expand Up @@ -192,11 +196,13 @@
"error_displaying_application": "显示任务详情时出错。",
"cancel": "操作已取消。",

"method_euler": "欧拉法",
"method_midpoint": "中点法",
"method_heun": "休恩法",
"method_runge_kutta": "龙格-库塔法",
"method_dormand_prince": "多曼德-普林斯法",
"numerical_methods": {
"euler": "欧拉法",
"midpoint": "中点法",
"heun": "休恩法",
"runge_kutta": "龙格-库塔法",
"dormand_prince": "多曼德-普林斯法"
},

"method": "方法",
"equation": "方程",
Expand Down
64 changes: 32 additions & 32 deletions solver-bot/src/main/python/shell.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@

MENU, EQUATION, INITIAL_X, INITIAL_Y, REACH_POINT, STEP_SIZE = range(6)

DEFAULT_METHOD = "method_runge_kutta"
DEFAULT_METHOD = "runge_kutta"
DEFAULT_ROUNDING = "4"
DEFAULT_LANGUAGE = "en"
DEFAULT_HINTS = "true"
Expand Down Expand Up @@ -203,35 +203,35 @@ async def settings_method(update: Update, context: ContextTypes.DEFAULT_TYPE):

keyboard = [
[InlineKeyboardButton(
f"→ {LANG_TEXTS[current_language]["method_euler"]} ←",
callback_data="method_euler")
if current_method == "method_euler" else InlineKeyboardButton(
LANG_TEXTS[current_language]["method_euler"],
callback_data="method_euler")],
f"→ {LANG_TEXTS[current_language]["numerical_methods"]["euler"]} ←",
callback_data="euler")
if current_method == "euler" else InlineKeyboardButton(
LANG_TEXTS[current_language]["numerical_methods"]["euler"],
callback_data="euler")],
[InlineKeyboardButton(
f"→ {LANG_TEXTS[current_language]["method_midpoint"]} ←",
callback_data="method_midpoint")
if current_method == "method_midpoint" else InlineKeyboardButton(
LANG_TEXTS[current_language]["method_midpoint"],
callback_data="method_midpoint")],
f"→ {LANG_TEXTS[current_language]["numerical_methods"]["midpoint"]} ←",
callback_data="midpoint")
if current_method == "midpoint" else InlineKeyboardButton(
LANG_TEXTS[current_language]["numerical_methods"]["midpoint"],
callback_data="midpoint")],
[InlineKeyboardButton(
f"→ {LANG_TEXTS[current_language]["method_heun"]} ←",
callback_data="method_heun")
if current_method == "method_heun" else InlineKeyboardButton(
LANG_TEXTS[current_language]["method_heun"],
callback_data="method_heun")],
f"→ {LANG_TEXTS[current_language]["numerical_methods"]["heun"]} ←",
callback_data="heun")
if current_method == "heun" else InlineKeyboardButton(
LANG_TEXTS[current_language]["numerical_methods"]["heun"],
callback_data="heun")],
[InlineKeyboardButton(
f"→ {LANG_TEXTS[current_language]["method_runge_kutta"]} ←",
callback_data="method_runge_kutta")
if current_method == "method_runge_kutta" else InlineKeyboardButton(
LANG_TEXTS[current_language]["method_runge_kutta"],
callback_data="method_runge_kutta")],
f"→ {LANG_TEXTS[current_language]["numerical_methods"]["runge_kutta"]} ←",
callback_data="runge_kutta")
if current_method == "runge_kutta" else InlineKeyboardButton(
LANG_TEXTS[current_language]["numerical_methods"]["runge_kutta"],
callback_data="runge_kutta")],
[InlineKeyboardButton(
f"→ {LANG_TEXTS[current_language]["method_dormand_prince"]} ←",
callback_data="method_dormand_prince")
if current_method == "method_dormand_prince" else InlineKeyboardButton(
LANG_TEXTS[current_language]["method_dormand_prince"],
callback_data="method_dormand_prince")],
f"→ {LANG_TEXTS[current_language]["numerical_methods"]["dormand_prince"]} ←",
callback_data="dormand_prince")
if current_method == "dormand_prince" else InlineKeyboardButton(
LANG_TEXTS[current_language]["numerical_methods"]["dormand_prince"],
callback_data="dormand_prince")],
[InlineKeyboardButton(
LANG_TEXTS[current_language]["back"],
callback_data="settings_back")]
Expand Down Expand Up @@ -478,11 +478,11 @@ async def solve_history_details(update: Update, context: ContextTypes.DEFAULT_TY
initial_y_str = str(initial_y)

method_mapping = {
"euler": LANG_TEXTS[current_language]["method_euler"],
"midpoint": LANG_TEXTS[current_language]["method_midpoint"],
"heun": LANG_TEXTS[current_language]["method_heun"],
"rungeKutta": LANG_TEXTS[current_language]["method_runge_kutta"],
"dormandPrince": LANG_TEXTS[current_language]["method_dormand_prince"]
"euler": LANG_TEXTS[current_language]["numerical_methods"]["euler"],
"midpoint": LANG_TEXTS[current_language]["numerical_methods"]["midpoint"],
"heun": LANG_TEXTS[current_language]["numerical_methods"]["heun"],
"rungeKutta": LANG_TEXTS[current_language]["numerical_methods"]["runge_kutta"],
"dormandPrince": LANG_TEXTS[current_language]["numerical_methods"]["dormand_prince"]
}

method_display = method_mapping.get(method, method)
Expand Down Expand Up @@ -959,7 +959,7 @@ def main() -> None:
CallbackQueryHandler(settings_language, pattern="^settings_language$"),
CallbackQueryHandler(
method,
pattern="^method_(euler|midpoint|heun|runge_kutta|dormand_prince)$"
pattern="^(euler|midpoint|heun|runge_kutta|dormand_prince)$"
),
CallbackQueryHandler(rounding, pattern="^(4|6|8|16)$"),
CallbackQueryHandler(language, pattern="^(en|ru|zh)$"),
Expand Down
10 changes: 5 additions & 5 deletions solver-bot/src/main/python/spring_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,11 @@ async def set_parameters(
initial_x, initial_y, reach_point, step_size
):
method_mapping = {
"method_euler": "euler",
"method_midpoint": "midpoint",
"method_heun": "heun",
"method_runge_kutta": "rungeKutta",
"method_dormand_prince": "dormandPrince",
"euler": "euler",
"midpoint": "midpoint",
"heun": "heun",
"runge_kutta": "rungeKutta",
"dormand_prince": "dormandPrince",
}

payload = {
Expand Down