

GridSize = Vector2.new(math.floor( / (.Offset + .Offset)),math.floor( / (.Offset + .Offset))) 1Click:Connect(function() - This runs when the user generates the gridį = omOffset(tonumber(Size),tonumber(Size))
Wepic conways game of life source code download#
Demonstration: Uncopylocked place Download here (50.2 KB) Source code: - Main local Players game.Players local ReplicatedFirst game.ReplicatedFirst.

[[ Applies all the operations that where planned before, this is done later, so that we calculate theĮverything and ONLY THEN apply the chanagesįor Object, AliveStatus in pairs(OperationsPlanned) do Greetings devs I am now open sourcing two of my projects and this is one of them This is a simple implementation of the famous cellular automata - Conway’s game of life For anyone who does not know what that is, here is an explantation. If TotalAliveNeighbors = AliveNeighborSpawnInt then If TotalAliveNeighbors MaximumAliveNeighborAmount then The game rules are here, you can change the numbers and see what happens! If GetCellAliveFromVector2(Vector2.new(X - 1,Y - 1)) = true then If GetCellAliveFromVector2(Vector2.new(X,Y - 1)) = true then If GetCellAliveFromVector2(Vector2.new(X + 1,Y - 1)) = true then If GetCellAliveFromVector2(Vector2.new(X + 1,Y)) = true then If GetCellAliveFromVector2(Vector2.new(X + 1,Y + 1)) = true then If GetCellAliveFromVector2(Vector2.new(X,Y + 1)) = true then If GetCellAliveFromVector2(Vector2.new(X - 1,Y + 1)) = true then If GetCellAliveFromVector2(Vector2.new(X - 1,Y)) = true then Counts how many of the eight neighbors are alive Local Alive = value:GetAttribute("Alive") Local Tween = TweenService:Create(Cell.Glow,TweenInfo.new(0.5,), - Records changes to do when everything is calculatedįor index,value in pairs(Frame:GetChildren()) do - Goes through every cell Visit us Source Codes for Beginners / Lab Assignments projects, final year projects and source codes.
Wepic conways game of life source code code#
Conway's Game of Life is a Beginners / Lab Assignments source code in C programming language. If Cell:GetAttribute("Alive") = true then Conway's Game of Life simulation program. Assigns a function to run when the cell changes the "Alive" attributeĬell.AttributeChanged:Connect(function(attribute) Creates cell and configures it here, gives it attributes like X,Y and Alive Made for debuging, just couns the cells Local function GenerateGrid() - Generates grid.įor index,value in pairs(Frame:GetChildren()) do If Vector.X = 0 or Vector.Y = 0 or Vector.X = GridSize.X + 1 or Vector.X = GridSize.Y + 1 or CellTable = nil then This checks if the requested cell is out of the grid Local function GetCellAliveFromVector2(Vector) - Cell coordinates go in and alive status goes out. Local GridSize = Vector2.new(math.floor( / (.Offset + .Offset)),math.floor( / (.Offset + .Offset))) Local AliveNeighborSpawnInt, MinimumAliveNeighborAmount, MaximumAliveNeighborAmount = 3,2,3 Local UserInputService = game:GetService("UserInputService") Local TweenService = game:GetService("TweenService") Local ReplicatedStorage = game.ReplicatedStorage Local ReplicatedFirst = game.ReplicatedFirst
