RoboCatz.com

Roblox Circle Maze

What is Vibe Coding?

Vibe Coding is a cool way to write programs with the help of AI (artificial intelligence). Imagine having a super-smart assistant by your side while coding! The AI can help you in different ways -- it might create an entire program for you, or just give you ideas and help with specific parts, depending on what you need.

To get started, you simply talk to the AI and explain what you want your program to do. The AI will then create a rough version of the program for you. After that, you can ask the AI questions, make suggestions, or request changes to add new features or fix things until the program is just the way you want it.

For this project, I will begin the AI chat with simple request about drawing a single triangle. As the conversation progresses, the requests will get more complex.

In this project, we will create a circular maze by drawing a complete circle and then selecting a small part of that circle to then draw a white disk (thereby erasing part of the circles edge). This erasure will form a doorway (or path) to enter or exit the circle. Subsequent layers of circles will be drawn with openings at various places to create a circular maze.

We will create a rough draft of the maze and then ask the computer to create a program that would replicate it.

To begin, create a single circle.

Roblox Art version

Example:
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local s = require(ReplicatedStorage.genericShapes)

s.circle()
Now resize it and rotate it.

Example:
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local s = require(ReplicatedStorage.genericShapes)

s.circle({x=0,y=6,z=0,thickness=9,size=30})
	:rotate(90,0,90)
	:fill(s.randomColor())
Now cut out an opening:

Example:
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local s = require(ReplicatedStorage.genericShapes)

s.circle({x=0,y=6,z=0,thickness=9,size=30})
	:rotate(90,0,90)
	:fill(s.randomColor())
	:cut(s.cube({x=15,y=4,z=0,thickness=9,size=10}),true)
Next, we need to create a second circle.

Example:
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local s = require(ReplicatedStorage.genericShapes)

s.circle({x=0,y=6,z=0,thickness=9,size=30})
	:rotate(90,0,90)
	:fill(s.randomColor())
	:cut(s.cube({x=15,y=4,z=0,thickness=9,size=10}),true)

s.circle({x=0,y=6,z=0,thickness=6,size=60})
	:rotate(90,0,90)
	:fill(s.randomColor())
	:cut(s.cube({x=0,y=4,z=30,size=10}),true)
Now let's continue this process for two additional circles.

Example:
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local s = require(ReplicatedStorage.genericShapes)

s.circle({x=0,y=6,z=0,thickness=9,size=30})
	:rotate(90,0,90)
	:fill(s.randomColor())
	:cut(s.cube({x=15,y=4,z=0,thickness=9,size=10}),true)

s.circle({x=0,y=6,z=0,thickness=6,size=60})
	:rotate(90,0,90)
	:fill(s.randomColor())
	:cut(s.cube({x=0,y=4,z=30,size=10}),true)

s.circle({x=0,y=6,z=0,thickness=6,size=90})
	:rotate(90,0,90)
	:fill(s.randomColor())
	:cut(s.cube({x=-45,y=4,z=0,thickness=9,size=10}),true)

s.circle({x=0,y=6,z=0,thickness=6,size=120})
	:rotate(90,0,90)
	:fill(s.randomColor())
	:cut(s.cube({x=0,y=4,z=-60,thickness=9,size=10}),true)
Now that we have a rough draft of the maze, let's ask AI to analyze what we started and create a new program from it.

I am using a Roblox graphics API program to teach how to use AI. It contains a function called: s.circle().

Here are a set of concentric circles with small openings at various places to form a simple maze. Look at the following Roblox code. Do you see a pattern in the following?

local ReplicatedStorage = game:GetService("ReplicatedStorage")
local s = require(ReplicatedStorage.genericShapes)

s.circle({x=0,y=6,z=0,thickness=9,size=30})
	:rotate(90,0,90)
	:fill(s.randomColor())
	:cut(s.cube({x=15,y=4,z=0,thickness=9,size=10}),true)

s.circle({x=0,y=6,z=0,thickness=6,size=60})
	:rotate(90,0,90)
	:fill(s.randomColor())
	:cut(s.cube({x=0,y=4,z=30,size=10}),true)

s.circle({x=0,y=6,z=0,thickness=6,size=90})
	:rotate(90,0,90)
	:fill(s.randomColor())
	:cut(s.cube({x=-45,y=4,z=0,thickness=9,size=10}),true)

s.circle({x=0,y=6,z=0,thickness=6,size=120})
	:rotate(90,0,90)
	:fill(s.randomColor())
	:cut(s.cube({x=0,y=4,z=-60,thickness=9,size=10}),true)
Write a program that draws a maze of 10 circles. The small openings in each circle should be placed at random locations along the circumference of the circle. There should be only one opening for each circle drawn. Use sine and cosine to calculate the coordinates of the smaller white circle.




Did the AI give you a program?

In this particular graphics API, can you change the 'let' to 'var'?

3D Art version

Example:
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local s = require(ReplicatedStorage.genericShapes)

local centerX, centerY, centerZ = 0, 6, 0
local numCircles = 10

for i = 1, numCircles do
    local size = i * 30              -- circle diameter
    local radius = size / 2          -- radius for trig
    local thickness = 6              -- wall thickness

    -- pick a random angle for the opening
    local angle = math.random() * math.pi * 2
    local ox = centerX + radius * math.cos(angle)
    local oz = centerZ + radius * math.sin(angle)

    -- draw the circle
    s.circle({
        x = centerX,
        y = centerY,
        z = centerZ,
        size = size,
        thickness = thickness
    })
    :rotate(90, 0, 90)
    :fill(s.randomColor())
    :cut(
        s.cube({
            x = ox,
            y = 4,
            z = oz,
            size = 10,
            thickness = 9
        }),
        true
    )
end