概要
robloxでassistantやってみた。
練習問題やってみた。
練習問題
zundokoを表示せよ。
写真
サンプルコード
local player = game.Players.LocalPlayer
local PlayerGui = player:WaitForChild("PlayerGui")
local gui = PlayerGui:WaitForChild("ScreenGui")
gui.TextButton.MouseButton1Click:Connect(function()
local zundoko = {"ズン", "ドコ"}
local sequence = {}
local res = ""
local function checkZundoko(sequence)
local n = #sequence
if n < 5 then
return false
end
for i = 1, n - 4 do
if sequence[i] == "ズン" and sequence[i+1] == "ズン" and sequence[i+2] == "ズン" and sequence[i+3] == "ズン" and sequence[i+4] == "ドコ" then
return true
end
end
return false
end
while not checkZundoko(sequence) do
local randomIndex = math.random(1, 2)
table.insert(sequence, zundoko[randomIndex])
res ..= zundoko[randomIndex]
end
res ..= "キ・ヨ・シ!"
gui.TextBox.Text = res
end)
以上。