{"id":18573217,"url":"https://github.com/harshitrv/dice-game","last_synced_at":"2026-03-19T05:07:11.583Z","repository":{"id":132986464,"uuid":"370785135","full_name":"HarshitRV/Dice-Game","owner":"HarshitRV","description":"A simple Dice game to settle your arguments. I build it to test and improve my JS skills.","archived":false,"fork":false,"pushed_at":"2022-01-01T07:05:46.000Z","size":21,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-05-15T23:12:55.456Z","etag":null,"topics":["dice-game"],"latest_commit_sha":null,"homepage":"https://github.com/lucifer00911/Dice-Game","language":"HTML","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/HarshitRV.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":"2021-05-25T18:04:07.000Z","updated_at":"2022-05-09T09:13:31.000Z","dependencies_parsed_at":null,"dependency_job_id":"13c72e87-8d88-4af2-a130-2c7120ff27a8","html_url":"https://github.com/HarshitRV/Dice-Game","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/HarshitRV/Dice-Game","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/HarshitRV%2FDice-Game","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/HarshitRV%2FDice-Game/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/HarshitRV%2FDice-Game/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/HarshitRV%2FDice-Game/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/HarshitRV","download_url":"https://codeload.github.com/HarshitRV/Dice-Game/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/HarshitRV%2FDice-Game/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28754807,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-25T13:59:49.818Z","status":"ssl_error","status_checked_at":"2026-01-25T13:59:33.728Z","response_time":113,"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":["dice-game"],"created_at":"2024-11-06T23:08:26.394Z","updated_at":"2026-01-25T15:03:38.541Z","avatar_url":"https://github.com/HarshitRV.png","language":"HTML","funding_links":[],"categories":[],"sub_categories":[],"readme":"# DICE GAME\n### A simple dice game .\n\n### Play the game here : [PLAY](https://lucifer00911.github.io/Dice-Game/)\n\n#\n\n# JAVASCRIPT LOGIC\n\n```\n//Array of images that are used\nconst arrImg = [\"images/1_dice.png\",\"images/2_dice.png\",\"images/3_dice.png\",\"images/4_dice.png\",\"images/5_dice.png\",\"images/6_dice.png\"]\n\n//Function to select one of the images from the array\nlet newDice = (arrImg) =\u003e {\n    let random = Math.floor(arrImg.length*Math.random())\n    return arrImg[random]\n}\n\n//Assign the images to a first dice variable\nvar randomDice1 = newDice(arrImg);\n//Another variable to save the number part from the image text of first dice \nvar dice1Num = Number(randomDice1[7]);\n\n//Assign the images to a second dice variable\nvar randomDice2 = newDice(arrImg);\n//Another variable to save the number part from the image text of second dice\nvar dice2Num = Number(randomDice2[7]);\n\n\n//Changing the \u003cimg\u003e src attribute according to random image\ndocument.getElementById(\"dice1\").setAttribute(\"src\",randomDice1)\ndocument.getElementById(\"dice2\").setAttribute(\"src\",randomDice2)    \n\n\n//Logic to check which player won ?\nif(dice1Num === dice2Num){\n    document.getElementById(\"refresh\").textContent = \"Draw\"\n}\nelse if(dice1Num \u003e dice2Num){\n    document.getElementById(\"refresh\").textContent = \"Player 1 Wins\"\n}\nelse{\n    document.getElementById(\"refresh\").textContent = \"Player 2 Wins\"\n}\n\nconsole.log(randomDice)\n```\n#","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fharshitrv%2Fdice-game","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fharshitrv%2Fdice-game","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fharshitrv%2Fdice-game/lists"}