{"id":19548308,"url":"https://github.com/vasu7052/smart-maze","last_synced_at":"2025-06-26T01:37:40.930Z","repository":{"id":198763561,"uuid":"112849932","full_name":"Vasu7052/Smart-Maze","owner":"Vasu7052","description":"This is a simple Smart Maze Bot created Using Genetic Algorithm in Python ","archived":false,"fork":false,"pushed_at":"2018-04-11T11:31:49.000Z","size":154,"stargazers_count":6,"open_issues_count":1,"forks_count":6,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-04-04T17:47:39.675Z","etag":null,"topics":["ai","genetic-algorithm","genetic-programming","maze-game","maze-solver","pygame","python"],"latest_commit_sha":null,"homepage":"","language":"Python","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/Vasu7052.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}},"created_at":"2017-12-02T14:47:23.000Z","updated_at":"2024-10-18T15:30:55.000Z","dependencies_parsed_at":null,"dependency_job_id":"d5c33ee6-0b52-46c8-85f9-d7b7b1818d7d","html_url":"https://github.com/Vasu7052/Smart-Maze","commit_stats":null,"previous_names":["vasu7052/smart-maze"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Vasu7052%2FSmart-Maze","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Vasu7052%2FSmart-Maze/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Vasu7052%2FSmart-Maze/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Vasu7052%2FSmart-Maze/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Vasu7052","download_url":"https://codeload.github.com/Vasu7052/Smart-Maze/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":251041730,"owners_count":21527244,"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":["ai","genetic-algorithm","genetic-programming","maze-game","maze-solver","pygame","python"],"created_at":"2024-11-11T03:55:28.780Z","updated_at":"2025-04-26T19:32:59.948Z","avatar_url":"https://github.com/Vasu7052.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Smart-Maze\n\nThis project is the implementation of the Smart Maze using genetic algorithm in Python  \n\nThe project is done using Python 3.6 with the following dependencies:\n- numpy: http://www.numpy.org/\n- pygame: http://www.pygame.org/download.shtml\n\n# Working\n\nYou can see the working project [https://www.youtube.com/watch?v=7Va9Ivb2ExU](https://www.youtube.com/watch?v=7Va9Ivb2ExU)\n\u003cbr\u003e\n[![Project Video](https://img.youtube.com/vi/7Va9Ivb2ExU/0.jpg)](https://www.youtube.com/watch?v=7Va9Ivb2ExU)\n\n# Genetic Algorithm\n\nA genetic algorithm is a search heuristic that is inspired by Charles Darwin’s theory of natural evolution. This algorithm reflects the process of natural selection where the fittest individuals are selected for reproduction in order to produce offspring of the next generation.\n\u003cimg src=\"https://github.com/androfly/Smart-Maze/blob/master/Images/img1.png\" alt=\"Genetic Algorithm\" style=\"width:200px;height:50px;\"\u003e\u003c/img\u003e\n## Notion of Natural Selection\n\nThe process of natural selection starts with the selection of fittest individuals from a population. They produce offspring which inherit the characteristics of the parents and will be added to the next generation. If parents have better fitness, their offspring will be better than parents and have a better chance at surviving. This process keeps on iterating and at the end, a generation with the fittest individuals will be found.\nThis notion can be applied for a search problem. We consider a set of solutions for a problem and select the set of best ones out of them.\nFive phases are considered in a genetic algorithm.\n1. Initial population\n2. Fitness function\n3. Selection\n4. Crossover\n5. Mutation\n## Initial Population\nThe process begins with a set of individuals which is called a Population. Each individual is a solution to the problem you want to solve.\nAn individual is characterized by a set of parameters (variables) known as Genes. Genes are joined into a string to form a Chromosome (solution).\nIn a genetic algorithm, the set of genes of an individual is represented using a string, in terms of an alphabet. Usually, binary values are used (string of 1s and 0s). We say that we encode the genes in a chromosome.\n\n\u003cimg src=\"https://github.com/androfly/Smart-Maze/blob/master/Images/img2.png\" alt=\"Genetic Algorithm\" style=\"width:200px;height:50px;\"\u003e\u003c/img\u003e\n\n## Fitness Function\nThe fitness function determines how fit an individual is (the ability of an individual to compete with other individuals). It gives a fitness score to each individual. The probability that an individual will be selected for reproduction is based on its fitness score.\n## Selection\nThe idea of selection phase is to select the fittest individuals and let them pass their genes to the next generation.\nTwo pairs of individuals (parents) are selected based on their fitness scores. Individuals with high fitness have more chance to be selected for reproduction.\n## Crossover\nCrossover is the most significant phase in a genetic algorithm. For each pair of parents to be mated, a crossover point is chosen at random from within the genes.\nFor example, consider the crossover point to be 3 as shown below.\n\u003cimg src=\"https://github.com/androfly/Smart-Maze/blob/master/Images/img2.png\" alt=\"Genetic Algorithm\" \u003e\u003c/img\u003e\n\n **Offspring** are created by exchanging the genes of parents among themselves until the crossover point is reached.\n \n\u003cimg src=\"https://github.com/androfly/Smart-Maze/blob/master/Images/img3.png\" alt=\"Genetic Algorithm\" \u003e\u003c/img\u003e\n\nThe new offspring are added to the population.\n\n\u003cimg src=\"https://github.com/androfly/Smart-Maze/blob/master/Images/img4.png\" alt=\"Genetic Algorithm\" \u003e\u003c/img\u003e\n\n## Mutation\nIn certain new offspring formed, some of their genes can be subjected to a mutation with a low random probability. This implies that some of the bits in the bit string can be flipped.\n\n\u003cimg src=\"https://github.com/androfly/Smart-Maze/blob/master/Images/img5.png\" alt=\"Genetic Algorithm\" \u003e\u003c/img\u003e\n\nMutation occurs to maintain diversity within the population and prevent premature convergence.\n\n## Termination\nThe algorithm terminates if the population has converged (does not produce offspring which are significantly different from the previous generation). Then it is said that the genetic algorithm has provided a set of solutions to our problem.\n### Note\nThe population has a fixed size. As new generations are formed, individuals with least fitness die, providing space for new offspring.\nThe sequence of phases is repeated to produce individuals in each new generation which are better than the previous generation.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvasu7052%2Fsmart-maze","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fvasu7052%2Fsmart-maze","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvasu7052%2Fsmart-maze/lists"}