TAAFT
Free mode
100% free
Freemium
Free Trial
Deals

yuri gamboa

@yurigamboa Tasks: 61
๐Ÿ› ๏ธ 1 tool ๐Ÿ™ 48 karma
Apprentice
Joined: September 2024

yuri gamboa's tools

  • Luau and python coding
    AI-powered coding mastery for Luau and Python.
    Open
    409
    20
    5.0
    42
    Released 1y ago
    100% Free
    Here is a simple implementation of a number guessing game in Luau: ```lua -- Define the secret number local secretNumber = math.random(1, 100) -- Initialize the number of attempts local attempts = 0 -- Game loop while true do -- Ask the user for their guess print("Guess a number between 1 and 100:") local guess = tonumber(read()) -- Check if the input is a valid number if guess == nil then print("Invalid input. Please enter a number.") elseif guess < 1 or guess > 100 then print("Number out of range. Please enter a number between 1 and 100.") else -- Increment the number of attempts attempts = attempts + 1 -- Check if the guess is correct if guess == secretNumber then print("Congratulations! You found the secret number in " .. attempts .. " attempts.") break elseif guess < secretNumber then print("Too low! Try again.") else print("Too high! Try again.") end end end ``` This code will generate a random secret number between 1 and 100, and then repeatedly ask the user for their guess until they correctly guess the secret number. It also keeps track of the number of attempts and provides hints to the user if their guess is too high or too low. Note: The `read()` function is used to get input from the user, which is a built-in function in Luau. It returns a string, so we use `tonumber()` to convert it to a number.
0 AIs selected
Clear selection
#
Name
Task