effect give @a night_vision 999999 0 true
effect give @a saturation 999999 0 true
effect give @a resistance 999999 4 true
execute as @a[gamemode=!adventure] run gamemode adventure
kill @e[type=item]
setblock 59 12 54 air
execute if score Width Game > 9 Integer if score BlueDifficulty DiffThinkTime > 10 Integer if score P1AI Game = 1 Integer if score P2AI Game = 1 Integer run setblock 59 12 54 minecraft:birch_wall_sign[facing=west]{"front_text":{"messages":["{\"text\":\"Warning:\",\"color\":\"#FF0000\",\"bold\":true}","{\"text\":\"Very Slow AI\",\"color\":\"#FF3300\"}","{\"text\":\"V. Large Board\",\"color\":\"#FF8800\"}","{\"text\":\"Only AI Players\",\"color\":\"#FFCC00\"}"]}}
execute if score Width Game > 9 Integer if score RedDifficulty DiffThinkTime > 10 Integer if score P1AI Game = 1 Integer if score P2AI Game = 1 Integer run setblock 59 12 54 minecraft:birch_wall_sign[facing=west]{"front_text":{"messages":["{\"text\":\"Warning:\",\"color\":\"#FF0000\",\"bold\":true}","{\"text\":\"Very Slow AI\",\"color\":\"#FF3300\"}","{\"text\":\"V. Large Board\",\"color\":\"#FF8800\"}","{\"text\":\"Only AI Players\",\"color\":\"#FFCC00\"}"]}}
execute if score Width Game > 9 Integer unless score BlueDifficulty DiffThinkTime > 10 Integer unless score RedDifficulty DiffThinkTime > 10 Integer if score P1AI Game = 1 Integer if score P2AI Game = 1 Integer run setblock 59 12 54 minecraft:birch_wall_sign[facing=west]{"front_text":{"messages":["{\"text\":\"Warning:\",\"color\":\"#FF0000\",\"bold\":true}","{\"text\":\"V. Large Board\",\"color\":\"#FF8800\"}","{\"text\":\"Only AI Players\",\"color\":\"#FFCC00\"}","{\"text\":\"\"}"]}}
execute unless score Width Game > 9 Integer if score BlueDifficulty DiffThinkTime > 10 Integer if score P1AI Game = 1 Integer if score P2AI Game = 1 Integer run setblock 59 12 54 minecraft:birch_wall_sign[facing=west]{"front_text":{"messages":["{\"text\":\"Warning:\",\"color\":\"#FF0000\",\"bold\":true}","{\"text\":\"Very Slow AI\",\"color\":\"#FF3300\"}","{\"text\":\"Only AI Players\",\"color\":\"#FFCC00\"}","{\"text\":\"\"}"]}}
execute unless score Width Game > 9 Integer if score RedDifficulty DiffThinkTime > 10 Integer if score P1AI Game = 1 Integer if score P2AI Game = 1 Integer run setblock 59 12 54 minecraft:birch_wall_sign[facing=west]{"front_text":{"messages":["{\"text\":\"Warning:\",\"color\":\"#FF0000\",\"bold\":true}","{\"text\":\"Very Slow AI\",\"color\":\"#FF3300\"}","{\"text\":\"Only AI Players\",\"color\":\"#FFCC00\"}","{\"text\":\"\"}"]}}
execute unless score Width Game > 9 Integer unless score BlueDifficulty DiffThinkTime > 10 Integer unless score RedDifficulty DiffThinkTime > 10 Integer if score P1AI Game = 1 Integer if score P2AI Game = 1 Integer run setblock 59 12 54 minecraft:birch_wall_sign[facing=west]{"front_text":{"messages":["{\"text\":\"Warning:\",\"color\":\"#FF0000\",\"bold\":true}","{\"text\":\"Only AI Players\",\"color\":\"#FFCC00\"}","{\"text\":\"\"}","{\"text\":\"\"}"]}}
execute if score Width Game > 9 Integer if score BlueDifficulty DiffThinkTime > 10 Integer if score P1AI Game = 0 Integer run setblock 59 12 54 minecraft:birch_wall_sign[facing=west]{"front_text":{"messages":["{\"text\":\"Warning:\",\"color\":\"#FF0000\",\"bold\":true}","{\"text\":\"Very Slow AI\",\"color\":\"#FF3300\"}","{\"text\":\"V. Large Board\",\"color\":\"#FF8800\"}","{\"text\":\"\"}"]}}
execute if score Width Game > 9 Integer if score BlueDifficulty DiffThinkTime > 10 Integer if score P2AI Game = 0 Integer run setblock 59 12 54 minecraft:birch_wall_sign[facing=west]{"front_text":{"messages":["{\"text\":\"Warning:\",\"color\":\"#FF0000\",\"bold\":true}","{\"text\":\"Very Slow AI\",\"color\":\"#FF3300\"}","{\"text\":\"V. Large Board\",\"color\":\"#FF8800\"}","{\"text\":\"\"}"]}}
execute if score Width Game > 9 Integer if score RedDifficulty DiffThinkTime > 10 Integer if score P1AI Game = 0 Integer run setblock 59 12 54 minecraft:birch_wall_sign[facing=west]{"front_text":{"messages":["{\"text\":\"Warning:\",\"color\":\"#FF0000\",\"bold\":true}","{\"text\":\"Very Slow AI\",\"color\":\"#FF3300\"}","{\"text\":\"V. Large Board\",\"color\":\"#FF8800\"}","{\"text\":\"\"}"]}}
execute if score Width Game > 9 Integer if score RedDifficulty DiffThinkTime > 10 Integer if score P2AI Game = 0 Integer run setblock 59 12 54 minecraft:birch_wall_sign[facing=west]{"front_text":{"messages":["{\"text\":\"Warning:\",\"color\":\"#FF0000\",\"bold\":true}","{\"text\":\"Very Slow AI\",\"color\":\"#FF3300\"}","{\"text\":\"V. Large Board\",\"color\":\"#FF8800\"}","{\"text\":\"\"}"]}}
execute if score Width Game > 9 Integer unless score BlueDifficulty DiffThinkTime > 10 Integer unless score RedDifficulty DiffThinkTime > 10 Integer if score P1AI Game = 0 Integer run setblock 59 12 54 minecraft:birch_wall_sign[facing=west]{"front_text":{"messages":["{\"text\":\"Warning:\",\"color\":\"#FF0000\",\"bold\":true}","{\"text\":\"V. Large Board\",\"color\":\"#FF8800\"}","{\"text\":\"\"}","{\"text\":\"\"}"]}}
execute if score Width Game > 9 Integer unless score BlueDifficulty DiffThinkTime > 10 Integer unless score RedDifficulty DiffThinkTime > 10 Integer if score P2AI Game = 0 Integer run setblock 59 12 54 minecraft:birch_wall_sign[facing=west]{"front_text":{"messages":["{\"text\":\"Warning:\",\"color\":\"#FF0000\",\"bold\":true}","{\"text\":\"V. Large Board\",\"color\":\"#FF8800\"}","{\"text\":\"\"}","{\"text\":\"\"}"]}}
execute unless score Width Game > 9 Integer if score BlueDifficulty DiffThinkTime > 10 Integer if score P1AI Game = 0 Integer run setblock 59 12 54 minecraft:birch_wall_sign[facing=west]{"front_text":{"messages":["{\"text\":\"Warning:\",\"color\":\"#FF0000\",\"bold\":true}","{\"text\":\"Very Slow AI\",\"color\":\"#FF3300\"}","{\"text\":\"\"}","{\"text\":\"\"}"]}}
execute unless score Width Game > 9 Integer if score BlueDifficulty DiffThinkTime > 10 Integer if score P2AI Game = 0 Integer run setblock 59 12 54 minecraft:birch_wall_sign[facing=west]{"front_text":{"messages":["{\"text\":\"Warning:\",\"color\":\"#FF0000\",\"bold\":true}","{\"text\":\"Very Slow AI\",\"color\":\"#FF3300\"}","{\"text\":\"\"}","{\"text\":\"\"}"]}}
execute unless score Width Game > 9 Integer if score RedDifficulty DiffThinkTime > 10 Integer if score P1AI Game = 0 Integer run setblock 59 12 54 minecraft:birch_wall_sign[facing=west]{"front_text":{"messages":["{\"text\":\"Warning:\",\"color\":\"#FF0000\",\"bold\":true}","{\"text\":\"Very Slow AI\",\"color\":\"#FF3300\"}","{\"text\":\"\"}","{\"text\":\"\"}"]}}
execute unless score Width Game > 9 Integer if score RedDifficulty DiffThinkTime > 10 Integer if score P2AI Game = 0 Integer run setblock 59 12 54 minecraft:birch_wall_sign[facing=west]{"front_text":{"messages":["{\"text\":\"Warning:\",\"color\":\"#FF0000\",\"bold\":true}","{\"text\":\"Very Slow AI\",\"color\":\"#FF3300\"}","{\"text\":\"\"}","{\"text\":\"\"}"]}}
execute if score InGame Game = 0 Integer as @a if data entity @s Inventory[0] run clear
execute unless score InGame Game = 2 Integer as @a if score InGame Game = 0 Integer if data entity @s Inventory[2] run clear
execute unless score InGame Game = 2 Integer as @a[tag=!Player1,tag=!Player2] if data entity @s Inventory[2] run clear
execute unless score InGame Game = 2 Integer if score P Game = 0 Integer as @a[tag=Player2,tag=!Player1] if data entity @s Inventory[2] run clear
execute unless score InGame Game = 2 Integer if score P Game = 1 Integer as @a[tag=Player1,tag=!Player2] if data entity @s Inventory[2] run clear
execute unless score InGame Game = 2 Integer if score InGame Game = 1 Integer if score P Game = 0 Integer as @a[tag=Player1] unless data entity @s Inventory[3] run clear
execute unless score InGame Game = 2 Integer if score P Game = 0 Integer as @a[tag=Player1] if data entity @s Inventory[4] run clear
execute unless score InGame Game = 2 Integer if score InGame Game = 1 Integer if score P Game = 1 Integer as @a[tag=Player2] unless data entity @s Inventory[3] run clear
execute unless score InGame Game = 2 Integer if score P Game = 1 Integer as @a[tag=Player2] if data entity @s Inventory[4] run clear
execute if score InGame Game = 1 Integer if score P Game = 0 Integer as @a[tag=Player1] unless score Sandbox Game = 1 Integer run item replace entity @s hotbar.0 with minecraft:carrot_on_a_stick{display:{Name:'{"text":"Kill/Birth Cell","italic":false,"color":"#FFFF80"}'},CustomModelData:1}
execute if score InGame Game = 1 Integer if score P Game = 1 Integer as @a[tag=Player2] unless score Sandbox Game = 1 Integer run item replace entity @s hotbar.0 with minecraft:carrot_on_a_stick{display:{Name:'{"text":"Kill/Birth Cell","italic":false,"color":"#FFFF80"}'},CustomModelData:4}
execute if score InGame Game = 1 Integer if score MayEndTurn Game = 0 Integer if score P Game = 0 Integer as @a[tag=Player1] unless score Sandbox Game = 1 Integer run item replace entity @s hotbar.1 with minecraft:glass{display:{Name:'{"text":"Can\'t End Turn","italic":false,"color":"red"}'}}
execute if score InGame Game = 1 Integer if score MayEndTurn Game = 0 Integer if score P Game = 1 Integer as @a[tag=Player2] unless score Sandbox Game = 1 Integer run item replace entity @s hotbar.1 with minecraft:glass{display:{Name:'{"text":"Can\'t End Turn","italic":false,"color":"red"}'}}
execute if score InGame Game = 1 Integer if score MayEndTurn Game = 1 Integer if score P Game = 0 Integer as @a[tag=Player1] unless score Sandbox Game = 1 Integer run item replace entity @s hotbar.1 with minecraft:carrot_on_a_stick{display:{Name:'{"text":"End Turn","italic":false,"color":"red"}'},CustomModelData:0}
execute if score InGame Game = 1 Integer if score MayEndTurn Game = 1 Integer if score P Game = 1 Integer as @a[tag=Player2] unless score Sandbox Game = 1 Integer run item replace entity @s hotbar.1 with minecraft:carrot_on_a_stick{display:{Name:'{"text":"End Turn","italic":false,"color":"red"}'},CustomModelData:0}
execute if score InGame Game = 1 Integer if score P Game = 0 Integer as @a[tag=Player1] if score Sandbox Game = 1 Integer run item replace entity @s hotbar.0 with minecraft:carrot_on_a_stick{display:{Name:'{"text":"Modify Cell","italic":false,"color":"#FFFF80"}'},CustomModelData:2}
execute if score InGame Game = 1 Integer if score P Game = 1 Integer as @a[tag=Player2] if score Sandbox Game = 1 Integer run item replace entity @s hotbar.0 with minecraft:carrot_on_a_stick{display:{Name:'{"text":"Modify Cell","italic":false,"color":"#FFFF80"}'},CustomModelData:2}
execute if score InGame Game = 1 Integer if score P Game = 0 Integer as @a[tag=Player1] if score Sandbox Game = 1 Integer run item replace entity @s hotbar.1 with minecraft:carrot_on_a_stick{display:{Name:'{"text":"Do Iteration","italic":false,"color":"red"}'},CustomModelData:0}
execute if score InGame Game = 1 Integer if score P Game = 1 Integer as @a[tag=Player2] if score Sandbox Game = 1 Integer run item replace entity @s hotbar.1 with minecraft:carrot_on_a_stick{display:{Name:'{"text":"Do Iteration","italic":false,"color":"red"}'},CustomModelData:0}
execute if score InGame Game = 1 Integer as @a run item replace entity @s hotbar.7 with minecraft:carrot_on_a_stick{display:{Name:'{"text":"Exit Game","italic":false,"color":"dark_red"}'},CustomModelData:3}
execute if score InGame Game = 1 Integer if score P Game = 0 Integer as @a[tag=Player1,tag=!Player2] unless score Sandbox Game = 1 Integer run item replace entity @s hotbar.8 with minecraft:blue_concrete{display:{Name:'{"text":"Blue","italic":false,"color":"#0000FF"}'}}
execute if score InGame Game = 1 Integer if score P Game = 1 Integer as @a[tag=Player2,tag=!Player1] unless score Sandbox Game = 1 Integer run item replace entity @s hotbar.8 with minecraft:red_concrete{display:{Name:'{"text":"Red","italic":false,"color":"#FF0000"}'}}
execute if score InGame Game = 1 Integer if score P Game = 1 Integer as @a[tag=Player1,tag=!Player2] unless score Sandbox Game = 1 Integer run item replace entity @s hotbar.8 with minecraft:blue_concrete{display:{Name:'{"text":"Blue","italic":false,"color":"#0000FF"}'}}
execute if score InGame Game = 1 Integer if score P Game = 0 Integer as @a[tag=Player2,tag=!Player1] unless score Sandbox Game = 1 Integer run item replace entity @s hotbar.8 with minecraft:red_concrete{display:{Name:'{"text":"Red","italic":false,"color":"#FF0000"}'}}
execute if score InGame Game = 1 Integer as @a[tag=Player1,tag=Player2] unless score Sandbox Game = 1 Integer run item replace entity @s hotbar.8 with minecraft:black_concrete{display:{Name:'{"text":"Blue/Red","italic":false}'}}
execute if score InGame Game = 1 Integer as @a[tag=!Player1,tag=!Player2] unless score Sandbox Game = 1 Integer run item replace entity @s hotbar.8 with minecraft:black_concrete{display:{Name:'{"text":"None","italic":false}'}}
execute if score InGame Game = 1 Integer as @a if score Sandbox Game = 1 Integer run item replace entity @s hotbar.8 with minecraft:black_concrete{display:{Name:'{"text":"None","italic":false}'}}
execute as @e[type=area_effect_cloud] run data modify entity @s Age set value 0
execute if score RenderTimer Timer = 8 Integer run function main:count
execute if score InGame Game = 1 Integer if score RenderTimer Timer = 8 Integer if score BLUE Game = 0 Integer if score RED Game > 0 Integer unless score Sandbox Game = 1 Integer run title @a times 10 80 10
execute if score InGame Game = 1 Integer if score RenderTimer Timer = 8 Integer if score BLUE Game = 0 Integer if score RED Game > 0 Integer unless score Sandbox Game = 1 Integer run title @a title [{"storage":"main:golad","nbt":"p2","color":"red"}," wins!"]
execute if score InGame Game = 1 Integer if score RenderTimer Timer = 8 Integer if score RED Game = 0 Integer if score BLUE Game > 0 Integer unless score Sandbox Game = 1 Integer run title @a times 10 80 10
execute if score InGame Game = 1 Integer if score RenderTimer Timer = 8 Integer if score RED Game = 0 Integer if score BLUE Game > 0 Integer unless score Sandbox Game = 1 Integer run title @a title [{"storage":"main:golad","nbt":"p1","color":"blue"}," wins!"]
execute if score InGame Game = 1 Integer if score RenderTimer Timer = 8 Integer if score RED Game = 0 Integer if score BLUE Game = 0 Integer unless score Sandbox Game = 1 Integer run title @a times 10 80 10
execute if score InGame Game = 1 Integer if score RenderTimer Timer = 8 Integer if score RED Game = 0 Integer if score BLUE Game = 0 Integer unless score Sandbox Game = 1 Integer run title @a title "Draw!"
execute if score InGame Game = 1 Integer if score RenderTimer Timer = 8 Integer unless score RED Game > 0 Integer unless score Sandbox Game = 1 Integer run scoreboard players set RenderTimer Timer -10000
execute if score InGame Game = 1 Integer if score RenderTimer Timer = 8 Integer unless score BLUE Game > 0 Integer unless score Sandbox Game = 1 Integer run scoreboard players set RenderTimer Timer -10000
execute if score P Game = 0 Integer run scoreboard players operation Current DiffThinkTime = BlueDifficulty DiffThinkTime
execute if score P Game = 1 Integer run scoreboard players operation Current DiffThinkTime = RedDifficulty DiffThinkTime
execute if score InGame Game = 1 Integer as @a[tag=Player1] if score P Game = 0 Integer if score @s Execute >= 1 Integer if score MayEndTurn Game = 1 Integer if score RenderTimer Timer > 10 Integer if data entity @s {SelectedItem:{tag:{CustomModelData:0}}} unless score Sandbox Game = 1 Integer run function main:endplayerturn
execute if score InGame Game = 1 Integer as @a[tag=Player1] if score P Game = 0 Integer if score @s Execute >= 1 Integer if score RenderTimer Timer > 10 Integer if data entity @s {SelectedItem:{tag:{CustomModelData:0}}} if score Sandbox Game = 1 Integer run scoreboard players set DoIteration Game 1
execute if score InGame Game = 1 Integer as @a[tag=Player1] if score P Game = 0 Integer if score @s Execute >= 1 Integer if score RenderTimer Timer > 10 Integer if data entity @s {SelectedItem:{tag:{CustomModelData:0}}} if score Sandbox Game = 1 Integer run scoreboard players set RenderTimer Timer -1
execute if score InGame Game = 1 Integer as @a[tag=Player1] if score P Game = 0 Integer if score @s Execute >= 1 Integer if score RenderTimer Timer > 10 Integer if data entity @s {SelectedItem:{tag:{CustomModelData:1}}} run function main:modify
execute if score InGame Game = 1 Integer as @a[tag=Player1] if score P Game = 0 Integer if score @s Execute >= 1 Integer if score RenderTimer Timer > 10 Integer if data entity @s {SelectedItem:{tag:{CustomModelData:2}}} run function main:sandbox
execute if score InGame Game = 1 Integer as @a[tag=Player2] if score P Game = 1 Integer if score @s Execute >= 1 Integer if score MayEndTurn Game = 1 Integer if score RenderTimer Timer > 10 Integer if data entity @s {SelectedItem:{tag:{CustomModelData:0}}} unless score Sandbox Game = 1 Integer run function main:endplayerturn
execute if score InGame Game = 1 Integer as @a[tag=Player2] if score P Game = 0 Integer if score @s Execute >= 1 Integer if score RenderTimer Timer > 10 Integer if data entity @s {SelectedItem:{tag:{CustomModelData:0}}} if score Sandbox Game = 1 Integer run scoreboard players set DoIteration Game 1
execute if score InGame Game = 1 Integer as @a[tag=Player2] if score P Game = 0 Integer if score @s Execute >= 1 Integer if score RenderTimer Timer > 10 Integer if data entity @s {SelectedItem:{tag:{CustomModelData:0}}} if score Sandbox Game = 1 Integer run scoreboard players set RenderTimer Timer -1
execute if score InGame Game = 1 Integer as @a[tag=Player2] if score P Game = 1 Integer if score @s Execute >= 1 Integer if score RenderTimer Timer > 10 Integer if data entity @s {SelectedItem:{tag:{CustomModelData:4}}} run function main:modify
execute if score InGame Game = 1 Integer as @a[tag=Player2] if score P Game = 1 Integer if score @s Execute >= 1 Integer if score RenderTimer Timer > 10 Integer if data entity @s {SelectedItem:{tag:{CustomModelData:2}}} run function main:sandbox
execute if score InGame Game = 1 Integer as @a if score @s Execute >= 1 Integer if data entity @s {SelectedItem:{tag:{CustomModelData:3}}} run function main:endgame
execute if score InGame Game = 2 Integer if score TutorialScene Game < 4 Integer as @a if score @s Execute >= 1 Integer if data entity @s {SelectedItem:{tag:{CustomModelData:0}}} run function main:nextscene
execute if score InGame Game = 2 Integer if score TutorialScene Game > 4 Integer as @a[tag=MainPlayer] if score @s Execute >= 1 Integer if score MayEndTurn Game = 1 Integer if score RenderTimer Timer > 10 Integer if data entity @s {SelectedItem:{tag:{CustomModelData:0}}} run function main:endplayerturn
execute if score InGame Game = 2 Integer as @a[tag=MainPlayer] if score @s Execute >= 1 Integer if score RenderTimer Timer > 10 Integer if data entity @s {SelectedItem:{tag:{CustomModelData:1}}} run function main:modify
execute as @a if score @s Execute >= 1 Integer run scoreboard players set @s Execute 0
execute if score RenderTimer Timer = 10 Integer if score InGame Game = 1 Integer if score P Game = 0 Integer if score P1AI Game = 1 Integer run scoreboard players set ThinkingTimer Timer 0
execute if score RenderTimer Timer = 10 Integer if score InGame Game = 1 Integer if score P Game = 1 Integer if score P2AI Game = 1 Integer run scoreboard players set ThinkingTimer Timer 0
execute if score RenderTimer Timer = 10 Integer if score InGame Game = 1 Integer if score P Game = 0 Integer if score P1AI Game = 1 Integer run function ai:initblueai
execute if score RenderTimer Timer = 10 Integer if score InGame Game = 1 Integer if score P Game = 1 Integer if score P2AI Game = 1 Integer run function ai:initredai
scoreboard players operation dtt Temp = Iteration Game
scoreboard players operation dtt Temp *= 100 Integer
scoreboard players operation dtt Temp /= Current DiffThinkTime
execute if score ThinkingTimer Timer <= Current DiffThinkTime if score InGame Game = 1 Integer if score Debug Game = 0 Integer if score P Game = 0 Integer if score Thinking Game = 0 Integer if score P1AI Game = 1 Integer run title @a actionbar [{"text":"The "},{"text":"BLUE","color":"blue"},{"text":" AI is thinking... "},{"score":{"objective":"Temp","name":"dtt"},"bold":true},{"text":"% ","bold":true},{"text":"■x","bold":true,"color":"blue"},{"score":{"objective":"Game","name":"BLUE"},"bold":true,"color":"blue"}," ",{"text":"■x","bold":true,"color":"red"},{"score":{"objective":"Game","name":"RED"},"bold":true,"color":"red"}]
execute if score ThinkingTimer Timer <= Current DiffThinkTime if score InGame Game = 1 Integer if score Debug Game = 0 Integer if score P Game = 1 Integer if score Thinking Game = 0 Integer if score P2AI Game = 1 Integer run title @a actionbar [{"text":"The "},{"text":"RED","color":"red"},{"text":" AI is thinking... "},{"score":{"objective":"Temp","name":"dtt"},"bold":true},{"text":"% ","bold":true},{"text":"■x","bold":true,"color":"blue"},{"score":{"objective":"Game","name":"BLUE"},"bold":true,"color":"blue"}," ",{"text":"■x","bold":true,"color":"red"},{"score":{"objective":"Game","name":"RED"},"bold":true,"color":"red"}]
execute if score ThinkingTimer Timer <= Current DiffThinkTime if score InGame Game = 1 Integer if score Debug Game = 1 Integer if score P Game = 0 Integer if score Thinking Game = 0 Integer if score P1AI Game = 1 Integer run title @a actionbar [{"text":"The "},{"text":"BLUE","color":"blue"},{"text":" AI is thinking... "},{"score":{"objective":"Temp","name":"dtt"},"bold":true},{"text":"% ","bold":true},{"text":"■x","bold":true,"color":"blue"},{"score":{"objective":"Game","name":"BLUE"},"bold":true,"color":"blue"}," ",{"text":"■x","bold":true,"color":"red"},{"score":{"objective":"Game","name":"RED"},"bold":true,"color":"red"}," Best: ",{"score":{"objective":"MinMaxScore","name":"Max"},"bold":true}]
execute if score ThinkingTimer Timer <= Current DiffThinkTime if score InGame Game = 1 Integer if score Debug Game = 1 Integer if score P Game = 1 Integer if score Thinking Game = 0 Integer if score P2AI Game = 1 Integer run title @a actionbar [{"text":"The "},{"text":"RED","color":"red"},{"text":" AI is thinking... "},{"score":{"objective":"Temp","name":"dtt"},"bold":true},{"text":"% ","bold":true},{"text":"■x","bold":true,"color":"blue"},{"score":{"objective":"Game","name":"BLUE"},"bold":true,"color":"blue"}," ",{"text":"■x","bold":true,"color":"red"},{"score":{"objective":"Game","name":"RED"},"bold":true,"color":"red"}," Best: ",{"score":{"objective":"MinMaxScore","name":"Min"},"bold":true}]
execute if score ThinkingTimer Timer < Current DiffThinkTime if score InGame Game = 1 Integer if score P Game = 0 Integer if score Thinking Game = 0 Integer if score P1AI Game = 1 Integer run function ai:blueai 
execute if score ThinkingTimer Timer < Current DiffThinkTime if score InGame Game = 1 Integer if score P Game = 1 Integer if score Thinking Game = 0 Integer if score P2AI Game = 1 Integer run function ai:redai
execute if score ThinkingTimer Timer > Current DiffThinkTime if score Thinking Game = 1 Integer run scoreboard players remove ThinkingTimer Timer 1
execute if score ThinkingTimer Timer = Current DiffThinkTime if score Thinking Game = 0 Integer if score P Game = 0 Integer if score P1AI Game = 1 Integer run function ai:finishblueai 
execute if score ThinkingTimer Timer = Current DiffThinkTime if score Thinking Game = 0 Integer if score P Game = 1 Integer if score P2AI Game = 1 Integer run function ai:finishredai
tag @e[tag=Board] remove Selected
scoreboard players set @e[tag=ToSacrifice] TempDepth 0
execute if entity @e[tag=ToBirth] at @e[tag=ToBirth,limit=1] run summon area_effect_cloud ~ ~2 ~ {Tags:[SacTarget],Particle:"block air"}
execute unless entity @e[tag=ToBirth] as @e[tag=ToSacrifice] at @s run summon area_effect_cloud ~ ~2 ~ {Tags:[SacTarget],Particle:"block air"}
execute as @e[tag=ToSacrifice] at @s positioned ~ ~2 ~ facing entity @e[tag=SacTarget,sort=furthest,limit=1] eyes run function main:animatesacrifice
kill @e[tag=SacTarget]
scoreboard players set Depth Temp 0
execute if score InGame Game = 0 Integer as @a unless entity @s[x=50,dx=10,y=10,dy=10,z=50,dz=10] run tp @s 55 11 55 -90 0
execute if score InGame Game = 1 Integer as @a if entity @s[x=50,dx=10,y=10,dy=10,z=50,dz=10] run tp @s 16.0 21 16.0 0 90
execute if score InGame Game = 2 Integer run function main:htploop
execute if score InGame Game = 2 Integer if score TutorialScene Game >= 4 Integer as @a[tag=MainPlayer] at @s anchored eyes rotated as @s run function main:select
execute if score InGame Game = 1 Integer if score P Game = 0 Integer unless entity @a[x=50,dx=10,y=10,dy=10,z=50,dz=10] as @a[tag=Player1] at @s anchored eyes rotated as @s run function main:select
execute if score InGame Game = 1 Integer if score P Game = 1 Integer unless entity @a[x=50,dx=10,y=10,dy=10,z=50,dz=10] as @a[tag=Player2] at @s anchored eyes rotated as @s run function main:select
scoreboard players set Depth2 Temp 0
execute as @a[x=50,dx=10,y=10,dy=10,z=50,dz=10] at @s anchored eyes rotated as @s run function main:selectmenu
execute if score RenderTimer Timer > 10 Integer at @e[tag=Selected] run particle minecraft:dust 0 1 0 0.5 ~0.5 ~2.1 ~ 0 0 0.25 1 5
execute if score RenderTimer Timer > 10 Integer at @e[tag=Selected] run particle minecraft:dust 0 1 0 0.5 ~-0.5 ~2.1 ~ 0 0 0.25 1 5
execute if score RenderTimer Timer > 10 Integer at @e[tag=Selected] run particle minecraft:dust 0 1 0 0.5 ~ ~2.1 ~0.5 0.25 0 0 1 5
execute if score RenderTimer Timer > 10 Integer at @e[tag=Selected] run particle minecraft:dust 0 1 0 0.5 ~ ~2.1 ~-0.5 0.25 0 0 1 5
execute if score RenderTimer Timer = 0 Integer if score DoIteration Game = 0 Integer run scoreboard players set RenderTimer Timer 5
execute if score RenderTimer Timer = 0 Integer if score DoIteration Game = 1 Integer run function main:iteration
execute if score RenderTimer Timer = 0 Integer if score DoIteration Game = 1 Integer run scoreboard players set DoIteration Game 0
execute unless entity @a[x=50,dx=10,y=10,dy=10,z=50,dz=10] if score RenderTimer Timer = 0 Integer run function main:renderfinal
execute unless entity @a[x=50,dx=10,y=10,dy=10,z=50,dz=10] if score RenderTimer Timer = 0 Integer run function main:renderf1
execute unless entity @a[x=50,dx=10,y=10,dy=10,z=50,dz=10] if score RenderTimer Timer = 1 Integer run function main:renderf2
execute unless entity @a[x=50,dx=10,y=10,dy=10,z=50,dz=10] if score RenderTimer Timer = 2 Integer run function main:renderf3
execute unless entity @a[x=50,dx=10,y=10,dy=10,z=50,dz=10] if score RenderTimer Timer = 3 Integer run function main:renderf4
execute unless entity @a[x=50,dx=10,y=10,dy=10,z=50,dz=10] if score RenderTimer Timer = 4 Integer run function main:renderf5
execute unless entity @a[x=50,dx=10,y=10,dy=10,z=50,dz=10] if score RenderTimer Timer = 5 Integer run function main:renderfinal
execute if score Debug Game = 1 Integer run execute at @e[tag=Sacrifice] run setblock ~ ~2 ~ stone_pressure_plate
execute if score Debug Game = 1 Integer run execute at @e[tag=Max] run setblock ~ ~2 ~ oak_pressure_plate
execute if score Debug Game = 1 Integer run execute at @e[tag=Min] run setblock ~ ~2 ~ dark_oak_pressure_plate
execute if score Debug Game = 1 Integer run execute at @e[tag=!Min,tag=!Max,tag=!Sacrifice] run setblock ~ ~2 ~ air
execute if score MenuItTimer Timer >= 20 Integer run function main:menuiteration
execute if score MenuItTimer Timer >= 20 Integer run scoreboard players add MenuIteration Game 1
execute if score MenuItTimer Timer >= 20 Integer run scoreboard players set MenuItTimer Timer 0
execute if entity @a[x=50,dx=10,y=10,dy=10,z=50,dz=10] if score MenuItTimer Timer = 0 Integer run function main:menurenderfinal
execute if entity @a[x=50,dx=10,y=10,dy=10,z=50,dz=10] if score MenuItTimer Timer = 0 Integer run function main:menurenderf1
execute if entity @a[x=50,dx=10,y=10,dy=10,z=50,dz=10] if score MenuItTimer Timer = 1 Integer run function main:menurenderf2
execute if entity @a[x=50,dx=10,y=10,dy=10,z=50,dz=10] if score MenuItTimer Timer = 2 Integer run function main:menurenderf3
execute if entity @a[x=50,dx=10,y=10,dy=10,z=50,dz=10] if score MenuItTimer Timer = 3 Integer run function main:menurenderf4
execute if entity @a[x=50,dx=10,y=10,dy=10,z=50,dz=10] if score MenuItTimer Timer = 4 Integer run function main:menurenderf5
execute if entity @a[x=50,dx=10,y=10,dy=10,z=50,dz=10] if score MenuItTimer Timer = 5 Integer run function main:menurenderfinal
execute if score ShouldRegenerate Game = 1 Integer run function main:countfuture
execute if score ShouldRegenerate Game = 1 Integer unless score REDF Game > 3 Integer run scoreboard players set ShouldRegenerate Game 2
execute if score ShouldRegenerate Game = 1 Integer unless score BLUEF Game > 3 Integer run scoreboard players set ShouldRegenerate Game 2
execute if score ShouldRegenerate Game = 1 Integer run scoreboard players set ShouldRegenerate Game 0
execute if score ShouldRegenerate Game = 2 Integer run function main:startgame
execute if score MenuItTimer Timer = 10 Integer if score MenuIteration Game >= 50 Integer run scoreboard players set ResetMenu Game 1
execute if score MenuItTimer Timer = 10 Integer unless entity @e[tag=MenuRed] run scoreboard players set ResetMenu Game 1
execute if score MenuItTimer Timer = 10 Integer unless entity @e[tag=MenuAlive,tag=!MenuRed] run scoreboard players set ResetMenu Game 1
execute if score MenuItTimer Timer = 10 Integer unless entity @e[tag=WillMenuDie] unless entity @e[tag=WillMenuLive] run scoreboard players set ResetMenu Game 1
execute if score ResetMenu Game = 1 Integer run tag @e[tag=MenuSim,limit=150,sort=random] add MenuAlive
execute if score ResetMenu Game = 1 Integer run tag @e[tag=MenuSim,limit=75,sort=random,tag=MenuAlive] add MenuRed
execute if score ResetMenu Game = 1 Integer run function main:updatemenuboard
execute if score ResetMenu Game = 1 Integer run scoreboard players set MenuIteration Game 0
execute if score ResetMenu Game = 1 Integer run scoreboard players set ResetMenu Game 0
execute unless entity @a[x=50,dx=10,y=10,dy=10,z=50,dz=10] if score ThinkingTimer Timer > Current DiffThinkTime run scoreboard players add RenderTimer Timer 1
execute if entity @a[x=50,dx=10,y=10,dy=10,z=50,dz=10] run scoreboard players add MenuItTimer Timer 1
execute unless entity @a[x=50,dx=10,y=10,dy=10,z=50,dz=10] run scoreboard players add ThinkingTimer Timer 1
execute at @e[tag=ToSacrifice] run particle soul ~ ~2 ~ 0.2 0.2 0.2 0 1
execute at @e[tag=ToKill] run particle soul ~ ~2 ~ 0.2 0.2 0.2 0 1
execute at @e[tag=ToBirth] run particle happy_villager ~ ~2 ~ 0.2 0.2 0.2 0 1
execute if score InGame Game = 1 Integer if score RenderTimer Timer = 10 Integer run function main:count
execute if score InGame Game = 1 Integer if score RenderTimer Timer > 10 Integer run title @a title ""
execute if score RenderTimer Timer > 10 Integer run scoreboard players set ToSacCount Game 0
execute if score RenderTimer Timer > 10 Integer as @e[tag=ToSacrifice] run scoreboard players add ToSacCount Game 1
execute if score InGame Game = 1 Integer if score RenderTimer Timer > 10 Integer if score P Game = 0 Integer run title @a[tag=Player1] actionbar [{"text":"■x","bold":true,"color":"blue"},{"score":{"objective":"Game","name":"BLUE"},"bold":true,"color":"blue"}," ",{"text":"■x","bold":true,"color":"red"},{"score":{"objective":"Game","name":"RED"},"bold":true,"color":"red"}]
execute if score InGame Game = 1 Integer if score RenderTimer Timer > 10 Integer if score P Game = 1 Integer run title @a[tag=Player2] actionbar [{"text":"■x","bold":true,"color":"blue"},{"score":{"objective":"Game","name":"BLUE"},"bold":true,"color":"blue"}," ",{"text":"■x","bold":true,"color":"red"},{"score":{"objective":"Game","name":"RED"},"bold":true,"color":"red"}]
execute if score InGame Game = 0 Integer run title @a actionbar ""
execute if score RenderTimer Timer > 10 Integer run scoreboard players set MayEndTurn Game 0
execute if score RenderTimer Timer > 10 Integer if entity @e[tag=ToKill] run scoreboard players set MayEndTurn Game 1
execute if score RenderTimer Timer > 10 Integer if entity @e[tag=ToSacrifice] if score ToSacCount Game = 1 Integer unless entity @e[tag=ToBirth] run scoreboard players set MayEndTurn Game 1
execute if score RenderTimer Timer > 10 Integer if score ToSacCount Game = 2 Integer if entity @e[tag=ToBirth] run scoreboard players set MayEndTurn Game 1
execute if score InGame Game = 0 Integer run tag @e[tag=Alive] remove Alive
execute if score InGame Game = 0 Integer run tag @e[tag=Red] remove Red
execute unless score P1AI Game = 1 Integer unless entity @a[tag=Player1] run function main:leaveblue
execute unless score P2AI Game = 1 Integer unless entity @a[tag=Player2] run function main:leavered
execute as @a unless score Current GameID = @s GameID run tag @s remove Player1
execute as @a unless score Current GameID = @s GameID run tag @s remove Player2
execute as @a unless score Current GameID = @s GameID unless entity @a[tag=Player1] run function main:joinblue
execute as @a unless score Current GameID = @s GameID run scoreboard players add Current GameID 1
execute as @a unless score Current GameID = @s GameID run scoreboard players operation @a GameID = Current GameID
execute if score RenderTimer Timer = -100 Integer run function main:endplayerturn
execute if score RenderTimer Timer = -9900 Integer run function main:endgame