{"id":20826756,"url":"https://github.com/cedrickchee/go-parkinglot","last_synced_at":"2026-05-26T05:02:10.861Z","repository":{"id":138118288,"uuid":"229763546","full_name":"cedrickchee/go-parkinglot","owner":"cedrickchee","description":"Go solution for parking lot algorithm and design problem","archived":false,"fork":false,"pushed_at":"2019-12-29T04:01:17.000Z","size":24,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-12-27T14:10:53.104Z","etag":null,"topics":["algorithms-and-data-structures","command-line-app","educational-project","golang","parking-lot"],"latest_commit_sha":null,"homepage":null,"language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/cedrickchee.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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":"2019-12-23T14:01:58.000Z","updated_at":"2025-03-25T09:28:28.000Z","dependencies_parsed_at":null,"dependency_job_id":"ade3352b-81f7-4561-b094-35b5000d7107","html_url":"https://github.com/cedrickchee/go-parkinglot","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/cedrickchee/go-parkinglot","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cedrickchee%2Fgo-parkinglot","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cedrickchee%2Fgo-parkinglot/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cedrickchee%2Fgo-parkinglot/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cedrickchee%2Fgo-parkinglot/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/cedrickchee","download_url":"https://codeload.github.com/cedrickchee/go-parkinglot/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cedrickchee%2Fgo-parkinglot/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":33504806,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T03:12:49.672Z","status":"ssl_error","status_checked_at":"2026-05-26T03:12:47.976Z","response_time":63,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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":["algorithms-and-data-structures","command-line-app","educational-project","golang","parking-lot"],"created_at":"2024-11-17T23:09:56.401Z","updated_at":"2026-05-26T05:02:10.833Z","avatar_url":"https://github.com/cedrickchee.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Parking Lot Algorithm\n\n## Intro\n\nThis project describes and solves a straighforward yet intricate problem of assigning vehicle slots using the appropriate data structures and Object-Oriented Programming patterns, in Go.\n\n## Problem\n\nJohn owns a multi-storey parking lot that can hold up to `n` vehicles at any given point in time. The parking slots are numbered, beginning at 1 and increases with increasing distance from the entry point in steps of one. John has requested your help to design an automated ticketing system for his parking lot.\n\nWhen a vehicle enters the parking lot, its vehicle registration number (i.e., number plate) and colour are noted. Then, an available parking slot is allocated. Following are the rules of parking slot ticket issuance:\n\n- Each customer should be allocated the nearest available parking slot to the entry point.\n- Upon exiting the parking lot, the customer returns the ticket which marks their previously allocated lot as now available.\n- Due to government regulation, the system should provide the ability to determine:\n  - Registration numbers of all cars of a particular colour.\n  - Slot number in which a car with a given registration number is parked.\n  - Slot numbers of all slots where a car of a particular colour is parked.\n\nThe ticketing system should be operable via two modes of input, namely, interactive commands and commands from a file. In other words, the ticketing system should be an executable which accepts:\n\n1. Interactive commands from an interactive command prompt shell\n2. A filename as an input argument at the command prompt and executes the commands from the given file\n\nExample below includes all the commands which need to be supported.\n\n**Example: File Input**\n\nLaunch the command line and run the code so it accepts input from a file:\n\n```sh\n$ parking_lot input_file.txt\n```\n\nInput (contents of _input_file.txt_ file):\n\n```sh\ncreate_parking_lot 6\npark KA-01-HH-1234 White\npark KA-01-HH-9999 White\npark KA-01-BB-0001 Black\npark KA-01-HH-7777 Red\npark KA-01-HH-2701 Blue\npark KA-01-HH-3141 Black\nleave 4\nstatus\npark KA-01-P-333 White\npark DL-12-AA-9999 White\nregistration_numbers_for_cars_with_colour White\nslot_numbers_for_cars_with_colour White\nslot_number_for_registration_number KA-01-HH-3141\nslot_number_for_registration_number MH-04-AY-1111\n```\n\nOutput (to STDOUT):\n\n```sh\nCreated a parking lot with 6 slots\nAllocated slot number: 1\nAllocated slot number: 2\nAllocated slot number: 3\nAllocated slot number: 4\nAllocated slot number: 5\nAllocated slot number: 6\nSlot number 4 is free\nSlot No. Registration No Colour\n1        KA-01-HH-1234   White\n2        KA-01-HH-9999   White\n3        KA-01-BB-0001   Black\n5        KA-01-HH-2701   Blue\n6        KA-01-HH-3141   Black\nAllocated slot number: 4\nSorry, parking lot is full\nKA-01-HH-1234, KA-01-HH-9999, KA-01-P-333\n1, 2, 4\n6\nNot found\n```\n\n**Example: Interactive**\n\nTo run the code, launch the command line, and the program will accept interactive input:\n\n```sh\n$ parking_lot\n```\n\nAssuming a parking lot with `n=6` slots, the following commands should be run in sequence by typing them in at a prompt and should produce output as described below the command. Note that `exit` terminates the process and returns control to the shell.\n\n```sh\n$ create_parking_lot 6\nCreated a parking lot with 6 slots\n\n$ park KA-01-HH-1234 White\nAllocated slot number: 1\n\n$ park KA-01-HH-9999 White\nAllocated slot number: 2\n\n$ park KA-01-BB-0001 Black\nAllocated slot number: 3\n\n$ park KA-01-HH-7777 Red\nAllocated slot number: 4\n\n$ park KA-01-HH-2701 Blue\nAllocated slot number: 5\n\n$ park KA-01-HH-3141 Black\nAllocated slot number: 6\n\n$ leave 4\nSlot number 4 is free\n\n$ status\nSlot No. Registration No Colour\n1        KA-01-HH-1234   White\n2        KA-01-HH-9999   White\n3        KA-01-BB-0001   Black\n5        KA-01-HH-2701   Blue\n6        KA-01-HH-3141   Black\n\n$ park KA-01-P-333 White\nAllocated slot number: 4\n\n$ park DL-12-AA-9999 White\nSorry, parking lot is full\n\n$ registration_numbers_for_cars_with_colour White\nKA-01-HH-1234, KA-01-HH-9999, KA-01-P-333\n\n$ slot_numbers_for_cars_with_colour White\n1, 2, 4\n\n$ slot_number_for_registration_number KA-01-HH-3141\n6\n\n$ slot_number_for_registration_number MH-04-AY-1111\nNot found\n$ exit\n```\n\n## Solution\n\n### Model\n\n_TODO_\n\n#### Parking Lot\n\n_TODO_\n\n#### Slot\n\n_TODO_\n\n#### Vehicle\n\n_TODO_\n\n## Installation Instructions\n\nAssuming you have [setup Go environment](https://golang.org/doc/install).\n\n1. Source code\n    - Git clone the project into a directory in your computer.\n        ```sh\n        git clone https://github.com/cedrickchee/go-parkinglot.git\n        ```\n    - `cd` into the repo\n        ```sh\n        cd go-parkinglot\n        ```\n2. Binary\n    - To create an executable binary in the `$GOPATH/bin/` directory, execute\n        ```sh\n        go install parking_lot\n        ```\n3. Unit test and functional test\n    - To run complete test suite, run\n        ```sh\n        go test -v parking_lot\n        ```\n        Here, `-v` is the verbose command flag.\n    - To run specific test, run\n        ```sh\n        go test -v parking_lot -run xxx\n        ```\n        Here, `xxx` is the name of test function.\n4. Running\n    - Launch interactive user input mode by executing\n        ```sh\n        $GOPATH/bin/parking_lot\n        ```\n    - Launch file input mode by executing\n        ```sh\n        $GOPATH/bin/parking_lot $GOPATH/src/github.com/cedrickchee/go-parkinglot/data/input_file.txt\n        ```\n        Here, `$GOPATH/src/github.com/cedrickchee/go-parkinglot/data/input_file.txt` refers to the input file with complete path.\n\n## Project Structure\n\n_TODO_\n\n## API\n\n_TODO_\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcedrickchee%2Fgo-parkinglot","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcedrickchee%2Fgo-parkinglot","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcedrickchee%2Fgo-parkinglot/lists"}