{"id":20767834,"url":"https://github.com/kyzn/hexgameoflifescala","last_synced_at":"2025-08-08T04:35:35.810Z","repository":{"id":73424442,"uuid":"50073649","full_name":"kyzn/hexGameOfLifeScala","owner":"kyzn","description":"Hex Game of Life in Scala","archived":false,"fork":false,"pushed_at":"2020-06-13T19:10:21.000Z","size":19,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-08-04T15:10:54.464Z","etag":null,"topics":["game-of-life","scala","ucsc"],"latest_commit_sha":null,"homepage":null,"language":"Scala","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/kyzn.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2016-01-21T01:39:45.000Z","updated_at":"2017-12-23T18:30:23.000Z","dependencies_parsed_at":"2023-05-28T10:15:08.943Z","dependency_job_id":null,"html_url":"https://github.com/kyzn/hexGameOfLifeScala","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/kyzn/hexGameOfLifeScala","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kyzn%2FhexGameOfLifeScala","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kyzn%2FhexGameOfLifeScala/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kyzn%2FhexGameOfLifeScala/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kyzn%2FhexGameOfLifeScala/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/kyzn","download_url":"https://codeload.github.com/kyzn/hexGameOfLifeScala/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kyzn%2FhexGameOfLifeScala/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":269365705,"owners_count":24405230,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-08-08T02:00:09.200Z","response_time":72,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["game-of-life","scala","ucsc"],"created_at":"2024-11-17T11:33:35.419Z","updated_at":"2025-08-08T04:35:35.634Z","avatar_url":"https://github.com/kyzn.png","language":"Scala","funding_links":[],"categories":[],"sub_categories":[],"readme":"This is the hex Game of Life (where you have 6 \nneighbors instead of 8) written in Scala.\nThis was a class assignment.\nCode reviews and pull requests are always welcome.\n\n\n\n# How to Run\n\nTo run the program, run following commands from\n  the directory where source codes are located: \n\n````\n$ scalac *.scala\n$ scala Life\n````\n\nOr if you want to pass arguments:\n\n````\n$ scala Life -12 -size 16\n````\n\n\n# Arguments\n\nProgram accepts following optional arguments.\n\n````\n-12      Runs in rule-12 mode when passed.\n         Program runs in rule-6 mode unless passed.\n\n-size n  Sets the size of the plane to n.\n         By default the plane has size 100.\n\n-f path  Reads the file at path and uses it as plane.\n         When this argument is used -size is ignored.\n\n-g n     Runs the simulation for n many times.\n         Simulation runs for 10 generations by default. \n\n-p n     Prints every nth generation if passed.\n         By default, program prints all generations.\n\n-i n     Sets the probability of being alive.\n         This is only used if cells are randomly assigned.\n         That is, if -f is used, this will be ignored.\n         By default the probabilty is set to 1/2.\n````\n\n#Structure\n\nWe have Cell, Row and Plane objects.\n\nIn main, we will create a plane object. We will be utilizing its methods to run the game of life smoothly.\n\nPlane object will consist of (size) many row objects.\n\nRow objects will consist of cell objects.\n\nEach class have their own functions. Usually, main makes its calls to plane object. Then plane object transfers call to its row objects. Each row object then applies some function to each of its rows.\n\nWe also have a loop that runs however many times user wants it to run.\n\nNo more border cells are used (unlike Java version, which is not uploaded to GitHub for now). Instead of that, try-catch blocks are utilized in neighbor assignment.\n\n\n#Neighbors\n\nNeighbor assignment is done once and for all, as in Java version. Since we know exact locations of neighbors of each cells, we can store them in an array of references.\n\nWhen assigning neighbors, for loop sometimes goes out of bounds. For example, cell at (0,0) would think cell at (-1,0) is its neighbor. This possible errors are handled by try-catch blocks.\n\nAssume our cell is [i,j] and its at an even row. (First) {second} neighbors are shown as follows:\n\n````\n                         { i-2,j }\n {i-1,j-2}   (i-1,j-1)   ( i-1,j )   {i-1,j+1}\n             (i  ,j-1)   [ i  ,j ]   (i  ,j+1)\n {i+1,j-2}   (i+1,j-1)   ( i+1,j )   {i+1,j+1}\n                         { i+2,j }\n````\n\nAnd when rows are shifted:\n\n````\n                         { i-2,j }\n        {i-1,j-2}   (i-1,j-1)   ( i-1,j )   {i-1,j+1}\n             (i  ,j-1)   [ i  ,j ]   (i  ,j+1)\n        {i+1,j-2}   (i+1,j-1)   ( i+1,j )   {i+1,j+1}\n                         { i+2,j }\n````\n\nLikewise, for [i,j]s that live on odd rows:\n\n````\n             { i-2,j }\n {i-1,j-1}   ( i-1,j )   (i-1,j+1)   {i-1,j+2}\n (i  ,j-1)   [ i  ,j ]   (i  ,j+1)\n {i+1,j-1}   ( i+1,j )   (i+1,j+1)   {i+1,j+2}\n             { i+2,j }\n````\n\nShifted:\n````\n                    { i-2,j }\n {i-1,j-1}   ( i-1,j )   (i-1,j+1)   {i-1,j+2}\n        (i  ,j-1)   [ i  ,j ]   (i  ,j+1)\n {i+1,j-1}   ( i+1,j )   (i+1,j+1)   {i+1,j+2}\n                    { i+2,j }\n````\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkyzn%2Fhexgameoflifescala","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkyzn%2Fhexgameoflifescala","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkyzn%2Fhexgameoflifescala/lists"}