Skip to content

Commit

Permalink
add TC2024DefenseA
Browse files Browse the repository at this point in the history
  • Loading branch information
Mark-tz committed May 14, 2024
1 parent 7279a01 commit 81386d6
Show file tree
Hide file tree
Showing 3 changed files with 81 additions and 0 deletions.
4 changes: 4 additions & 0 deletions Core/tactics/play/TC/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# TC技术挑战赛脚本
* 2024
* TC2024Attack 用于测试TC2024的进攻脚本
* TC2024DefenseA 场景A的防守脚本,自动调用ZJRoboCon2024TC作为裁判脚本
44 changes: 44 additions & 0 deletions Core/tactics/play/TC/TC2024Attack.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
local ORIGIN = CGeoPoint:new_local(0,0)
local CIRCLE_DIST = 1500
local WAIT_POS = {
ORIGIN + Utils.Polar2Vector(CIRCLE_DIST, 0*math.pi*2/3),
ORIGIN + Utils.Polar2Vector(CIRCLE_DIST, 1*math.pi*2/3),
ORIGIN + Utils.Polar2Vector(CIRCLE_DIST, 2*math.pi*2/3),
}
return {
firstState = "init",
["init"] = {
switch = function()
if player.toTargetDist("a") < 10 then
return "kickA"
end
end,
a = task.goCmuRush(WAIT_POS[1]),
b = task.goCmuRush(WAIT_POS[2]),
c = task.goCmuRush(WAIT_POS[3]),
match = "[abc]"
},
["kickA"] = {
switch = function()
if player.kickBall("a") then
return "kickB"
end
end,
a = task.touchKick(WAIT_POS[2],false,4000,true),
b = task.goCmuRush(WAIT_POS[2]),
c = task.goCmuRush(WAIT_POS[3]),
match = "{abc}",
},
["kickB"] = {
switch = function()
if player.kickBall("b") then
return "kickA"
end
end,
b = task.touchKick(WAIT_POS[1],false,4000,true),
a = task.goCmuRush(WAIT_POS[1]),
c = task.goCmuRush(WAIT_POS[3]),
match = "{abc}",
},
name = "TC2024Attack",
}
33 changes: 33 additions & 0 deletions Core/tactics/play/TC/TC2024DefenseA.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
local ORIGIN = CGeoPoint:new_local(0,0)
local RUN_DIST = 1200
local RUN_POS = {
ORIGIN + Utils.Polar2Vector(RUN_DIST, 0*math.pi*2/3),
ORIGIN + Utils.Polar2Vector(RUN_DIST, 1*math.pi*2/3),
ORIGIN + Utils.Polar2Vector(RUN_DIST, 2*math.pi*2/3),
}
return {
firstState = "reset",
["reset"] = {
switch = function()
gSubPlay.new("TC", "ZJRoboCon2024TC")
return "run"
end,
a = task.stop(),
match = "(a)"
},
["wait"] = {
switch = function()
return gSubPlay.getState("TC") == "run" and "run" or "wait"
end,
a = task.goCmuRush(ORIGIN,0),
match = "(a)"
},
["run"] = {
switch = function()
return gSubPlay.getState("TC") == "run" and "run" or "wait"
end,
a = task.runMultiPos(RUN_POS,true,30,0),
match = "(a)"
},
name = "TC2024DefenseA",
}

0 comments on commit 81386d6

Please sign in to comment.