{"id":21433079,"url":"https://github.com/randomtask2000/ballclock","last_synced_at":"2025-03-16T22:42:28.442Z","repository":{"id":218614839,"uuid":"117826920","full_name":"randomtask2000/BallClock","owner":"randomtask2000","description":null,"archived":false,"fork":false,"pushed_at":"2018-02-02T06:40:55.000Z","size":71,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"develop","last_synced_at":"2025-01-23T08:44:17.051Z","etag":null,"topics":["ball-clocks","ballclock","hour-indicator","java","minutes-track"],"latest_commit_sha":null,"homepage":"","language":"Java","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/randomtask2000.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}},"created_at":"2018-01-17T11:25:17.000Z","updated_at":"2018-01-20T18:29:41.000Z","dependencies_parsed_at":"2024-01-23T01:50:00.472Z","dependency_job_id":null,"html_url":"https://github.com/randomtask2000/BallClock","commit_stats":null,"previous_names":["randomtask2000/ballclock"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/randomtask2000%2FBallClock","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/randomtask2000%2FBallClock/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/randomtask2000%2FBallClock/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/randomtask2000%2FBallClock/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/randomtask2000","download_url":"https://codeload.github.com/randomtask2000/BallClock/tar.gz/refs/heads/develop","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243945527,"owners_count":20372893,"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","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":["ball-clocks","ballclock","hour-indicator","java","minutes-track"],"created_at":"2024-11-22T23:24:42.655Z","updated_at":"2025-03-16T22:42:28.416Z","avatar_url":"https://github.com/randomtask2000.png","language":"Java","readme":"## Ball Clock Assignment\nMovement has long been used to measure time. For example, the ball clock is a simple device\nwhich keeps track of the passing minutes by moving ball-bearings. Each minute, a rotating arm\nremoves a ball bearing from the queue at the bottom, raises it to the top of the clock and\ndeposits it on a track leading to indicators displaying minutes, five-minutes, and hours. These\nindicators display the time between `1:00` and `12:59`, but without 'a.m.' or 'p.m.' indicators.\nThus 2 balls in the minute indicator, 6 balls in the five-minute indicator and 5 balls in the hour\nindicator displays the time `5:32`.\n\nUnfortunately, most commercially available ball clocks do not incorporate a date indication,\nalthough this would be simple to do with the addition of further carry and indicator tracks.\nHowever, all is not lost! As the balls migrate through the mechanism of the clock, the order\nthey are found in can be used to determine the time elapsed since the clock had some specific\nordering. The length of time which can be measured is limited because the orderings of the\nballs eventually begin to repeat. Your program must compute the time before repetition, which\nvaries according to the total number of balls present.\n\n#### Operation of the Ball Clock\nEvery minute, the least recently used ball is removed from the queue of balls at the bottom of\nthe clock, elevated, then deposited on the minute indicator track, which is able to hold four\nballs. When a fifth ball rolls on to the minute indicator track, its weight causes the track to tilt.\nThe four balls already on the track run back down to join the queue of balls waiting at the\nbottom in reverse order of their original addition to the minutes track. The fifth ball, which\ncaused the tilt, rolls down to the five-minute indicator track. This track holds eleven balls. The\ntwelfth ball carried over from the minutes causes the five-minute track to tilt, returning the\neleven balls to the queue, again in reverse order of their addition. The twelfth ball rolls down\nto the hour indicator. The hour indicator also holds eleven balls, but has one extra fixed ball\nwhich is always present so that counting the balls in the hour indicator will yield an hour in the\nrange one to twelve. The twelfth ball carried over from the five-minute indicator causes the\nhour indicator to tilt, returning the eleven free balls to the queue, in reverse order, before the\ntwelfth ball itself also returns to the queue.\n\n#### Guidelines\nThe exercise may be completed in `Java`, `Go`, `Python`, or `JavaScript`. You are welcome to do it in\nmore than one of the languages.\nNote: If you are doing this assignment as part of an application for employment, check with\nyour recruiter to determine what language(s) to use.\nNo permutation or `LCM` algorithms are allowed. A full simulation is required. Please ensure\nthat your code moves each ball.\n\n#### Implementation\nValid numbers of balls are in the range `27` to `127`. Ball inputs outside of this range should\nproduce an error message. Clocks must support two modes of computation. Each mode is\ndescribed below, along with sample inputs and outputs. For each mode, a final line of output\nshould indicate the amount of time (in both milliseconds and seconds) it took for the clock to\ncomplete that run.\n\n#### Mode 1 (Cycle Days)\nThe first mode takes a single parameter specifying the number of balls and reports the number\nof balls given in the input and the number of days (24-hour periods) which elapse before the\nclock returns to its initial ordering.\n\nAn input of 30 yields the following output:\n```\n30 balls cycle after 15 days.\nCompleted in x milliseconds (y.yyy seconds)\n```\nAn input of 45 yields the following output:\n```\n45 balls cycle after 378 days.\nCompleted in x milliseconds (y.yyy seconds)\n```\n\n#### Mode 2 (Clock State)\nThe second mode takes two parameters, the number of balls and the number of minutes to run\nfor. If the number of minutes is specified, the clock must run to the number of minutes and\nreport the state of the tracks at that point in a `JSON` format.\nAn input of `30` `325` yields the following output:\n```json\n{\"Min\":[],\"FiveMin\":[22,13,25,3,7],\"Hour\":[6,12,17,4,15],\"Main\":\n[11,5,26,18,2,30,19,8,24,10,29,20,16,21,28,1,23,14,27,9]}\n```\n#### Run with Gradle\n```bash\n./gradlew clean build\n```\nRun with no input arguments:\n```bash\njava -jar build/libs/BallClock-1.0.jar\n```\nThe application will the below message prompting you to pass an argument\n```\nNo args were passed! \nPlease enter the following args\n -b (-balls, -balls) 27                 : number of balls needs to be between\n                                          27 to 127\n -h (-help)                             : display options (default: false)\n -t (-minutes, -time, -m, -timeToRun) 1 : number of minutes needs to\n                                          be greater than zero\n -v (-verbose)                          : display message (default: false)\n```\nOr run the application directly through `gradle`\n```bash\ngradle run \n\u003e Task :run \n{\"Minutes\":[],\"FiveMin\":[22,13,25,3,7],\"Hours\":[6,12,17,4,15],\"Main\":[11,5,26,18,2,30,19,8,24,10,29,20,16,21,28,1,23,14,27,9]}\n```\nAn input of `-balls 27` yields the following output:\n```bash\njava -jar build/libs/BallClock-1.0.jar -balls 27\n27 balls cycle after 23 days.\nCompleted in 13 milliseconds (0.013 seconds)\n```\nAn input of `-balls 30` `-minutes 325` yields the following output:\n```bash\njava -jar build/libs/BallClock-1.0.jar -balls 30 -minutes 325\n```\nOutput:\n```json\n{\"Minutes\":[],\"FiveMin\":[22,13,25,3,7],\"Hours\":[6,12,17,4,15],\"Main\":[11,5,26,18,2,30,19,8,24,10,29,20,16,21,28,1,23,14,27,9]}\n```\n\n\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frandomtask2000%2Fballclock","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frandomtask2000%2Fballclock","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frandomtask2000%2Fballclock/lists"}