{"id":26591581,"url":"https://github.com/ariellourenco/life","last_synced_at":"2026-05-04T02:40:54.419Z","repository":{"id":282708089,"uuid":"948038959","full_name":"ariellourenco/life","owner":"ariellourenco","description":"This repository contains the implementation of Conway's Game of Life using ASP.NET Core.","archived":false,"fork":false,"pushed_at":"2025-08-23T17:07:26.000Z","size":76,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-08-23T23:41:12.113Z","etag":null,"topics":["aspnetcore","dotnet-core","rest-api"],"latest_commit_sha":null,"homepage":"https://en.wikipedia.org/wiki/Conway%27s_Game_of_Life","language":"C#","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ariellourenco.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,"zenodo":null}},"created_at":"2025-03-13T16:40:41.000Z","updated_at":"2025-08-23T17:07:30.000Z","dependencies_parsed_at":"2025-04-10T15:21:14.786Z","dependency_job_id":"8ba8c8e9-18a3-4efd-a158-d8a5629e130c","html_url":"https://github.com/ariellourenco/life","commit_stats":null,"previous_names":["ariellourenco/life"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/ariellourenco/life","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ariellourenco%2Flife","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ariellourenco%2Flife/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ariellourenco%2Flife/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ariellourenco%2Flife/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ariellourenco","download_url":"https://codeload.github.com/ariellourenco/life/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ariellourenco%2Flife/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32592720,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-03T22:12:39.696Z","status":"online","status_checked_at":"2026-05-04T02:00:06.625Z","response_time":58,"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":["aspnetcore","dotnet-core","rest-api"],"created_at":"2025-03-23T14:18:39.443Z","updated_at":"2026-05-04T02:40:54.413Z","avatar_url":"https://github.com/ariellourenco.png","language":"C#","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Conway's Game of Life\n\n[![.NET](https://github.com/ariellourenco/life/actions/workflows/dotnet.yml/badge.svg)](https://github.com/ariellourenco/life/actions/workflows/dotnet.yml)\n\nThis repository contains the implementation of [Conway's Game of Life](https://en.wikipedia.org/wiki/Conway%27s_Game_of_Life) using ASP.NET Core. It exposes the game logic via HTTP endpoints which allows clients to interact with the simulation programmatically, such as retrieving the current grid state or advancing to the next generation.\n\nIt showcases:\n\n- Minimal APIs\n- Using EntityFramework and SQLite for data access\n- OpenAPI\n- User management with ASP.NET Core Identity\n- Bearer authentication\n- Writing integration tests for your REST API\n\n## Assumptions\n\nThe implementation makes a few assumptions:\n\n1. The max board size is 100x100.\n2. Every cell outside the board is dead.\n\n## Features\n\n- Start a new [Conway's Game of Life](https://en.wikipedia.org/wiki/Conway%27s_Game_of_Life) with the provided board state.\n- Advance the board to the next generation.\n- Retrieve the state of the board after a specified number of generations.\n- Retrieve the final state of the board.\n\n## Running the Project\n\nTo run the project locally, follow these steps:\n\n1. Clone the repository:\n\n```bash\ngit clone https://github.com/ariellourenco/life.git\ncd life\n```\n\n1. Install the **dotnet-ef** tool: `dotnet tool install dotnet-ef -g`\n1. Navigate to the `life/src/Life.Api/` folder.\n    1. Run `mkdir .db` to create the local database folder.\n    1. Run `dotnet ef database update` to create the database.\n1. Learn more about [dotnet-ef](https://learn.microsoft.com/en-us/ef/core/cli/dotnet)\n\n## Running Tests\n\nTo run the unit tests, use the following command:\n\n```bash\ndotnet test\n```\n\n## Configuration\n\nThe application can be configured using the `appsettings.json` file. The following settings are available:\n\n- `MaxBoardSize`: The maximum size of the board.\n- `MaxNumberOfAttempts`: The maximum number of generations the game can run to reach a final stage.\n\n## Endpoints\n\nDown below there are a list of request samples that can be used to test the Game of Life api. Moreover, we provide an [.http](src/Life.Api/game.http) file as a convenient way to the this API.\n\n### Upload a New Board State\n\n**POST** `/api/game/start`\n\nStart a new [Conway's Game of Life](https://en.wikipedia.org/wiki/Conway%27s_Game_of_Life) with the provided board state and returns the ID of the game.\n\n**Request Body:**\n\n```json\n[\n  [false, true, false],\n  [false, true, false],\n  [false, true, false]\n]\n```\n\n**Response:**\n\n```json\n{\n  \"id\": \"guid\"\n}\n```\n\n### Get Next State for Board\n\n**GET** `/api/game/{id}/next`\n\nRetrieves the next state for the board.\n\n**Response:**\n\n```json\n[\n  [ false, true, false ],\n  [ false, true, false ],\n  [ false, true, false ]\n]\n```\n\n### Get State After X Generations\n\n**GET** `/api/game/{id}/next/{generations}`\n\nRetrieves the state of the board after a specified number of generations.\n\n**Response:**\n\n```json\n[\n  [ false, true, false ],\n  [ false, true, false ],\n  [ false, true, false ]\n]\n```\n\n### Get Final State for Board\n\n**GET** `/api/game/{id}/final`\n\nRetrieves the final state of the board. If the board doesn't reach a conclusion after a specified number of attempts, returns [422 Unprocessable Content](https://developer.mozilla.org/docs/Web/HTTP/Reference/Status/422) status code.\n\n**Response:**\n\n```json\n[\n  [ false, true, false ],\n  [ false, true, false ],\n  [ false, true, false ]\n]\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fariellourenco%2Flife","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fariellourenco%2Flife","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fariellourenco%2Flife/lists"}