Zulip that's not what I was trying to do :pensive:
Sorry for the noise y'all I'll have to repost after dinner
I started working on an implementation of Conway's game of life in Roc, but got distracted by other things and didn't finish it :sweat_smile: interested to see what you post after dinner ;)
This is cool. I've got a WIP TUI graphics library which might be cool to use with this.
It's just using basic-cli, and I'm still working on the API but basically this is the above App
State : {
screen : { width : I32, height : I32 },
cursor : { row : I32, col : I32 },
}
init : State
init = {
cursor: { row: 10, col: 10 },
screen: { width: 0, height: 0 },
}
render : State -> List DrawFn
render = \state ->
cursorStr = "CURSOR \(Num.toStr state.cursor.row), \(Num.toStr state.cursor.col)"
screenStr = "SCREEN \(Num.toStr state.screen.height), \(Num.toStr state.screen.width)"
[
drawCursor "+",
drawText cursorStr { row: state.screen.height - 2, col: 2 },
drawText screenStr { row: state.screen.height - 1, col: 2 },
drawBorder "*",
]
So here's the thing I originally shared and then accidentally deleted :laughter_tears:
https://gist.github.com/mulias/0007046725a6ca5500a35c125f033196
I made a Game of Life sim to demo Array2D, with the thought being it would be more interesting than a "here's how to use some functions from the package" example. I'm on the fence if it's a good demo for the package, since it's a bit long and doesn't show off the package as clearly as it could.
Would this be a good example to add to the website? We had talked about adding something related to 2d data before AoC, but I'm wondering if it makes more sense to add this example to the Array2D repo, link that repo on roc-awesome, and encourage AoC people to look there for resources.
My thoughts are this would be a good example for the package, and I would love to add to roc-awesome.
Elias Mulhall has marked this topic as resolved.
Added to roc-awesome. :hearts:
Game of Life is definitely something I'd like to add to the examples repo as well.
Last updated: Jul 06 2025 at 12:14 UTC