Monday, January 27, 2020

Sudoku Puzzle Design Algorithms Computer Science Essay

Sudoku Puzzle Design Algorithms Computer Science Essay Our project is called generating, rating and solving Sudoku puzzle. The aim of the project is to design and develop Sudoku puzzle solving program by generate the puzzle with five differences difficulty rating level. The program is able to solve the Sudoku puzzle by using some Artificial Intelligent algorithm. The final year project development period is given two trimester and we divided the development process into two part. The first part is to develop the problem specification, design, generating and study on some Sudoku solving algorithm which to be done by trimester one. Part 2 of the project is developing the complete Sudoku solving program and this part will be done by trimester 2. Chapter 1: Introduction 1.1 Introduction Sudoku is logic based number-placement puzzle. It designs with 99 grids so that the digits 1-9 appear exactly once in each row, each columns, and each 33 sub grids (also called as blocks) that compose the grid. Each Sudoku puzzle created with a unique solution, which typically means that there is only one correct way to fill in the 81 grids. The aim of the project is to design and develop Sudoku puzzle solving program using the artificial intelligence algorithm. First at all the Sudoku configuration program would be able to generate the puzzle with five differences difficulty rating level, which are very easy, easy, medium, difficult and expert. The program also able to solve the Sudoku puzzle as well as providing the chances of having tips while they achieve the specify condition which could help the player to solved the puzzle when they get stuck. An interesting Sudoku puzzle is the one with the minimal hints given. The puzzle should be generated with a single solution. So, knowledge for the rules of Sudoku is very important which the digit 1-9 need to be appear exactly once in each rows, each columns, and each 33 sub-grid. Then a 99 empty grid need to be created and filled in with the digit 1-9 by following the rules to create a complete puzzle. The next step is to begin removing digits from the completed Sudoku puzzle randomly to create the game. To generate a symmetrical puzzle, we need to randomly remove the singleton from the row, column, or block, following by naked pairs, naked triples, hidden pairs, hidden triples, and pointing pairs accordingly. The techniques used to remove the cells decided the difficulty level of the Sudoku puzzle. Lastly, the program is able to solve the Sudoku game by using the AI algorithm like simulated annealing. 1.2 Problem statement People nowadays always busy for working and cope for the challenges on their life. With the increasing busyness of the life, stress become a common issue that faced by the society. A long term of facing a particular problem will make a people to feel pressure and stress themselves badly. Therefore, they need some break to take their mind off from working materials before they continue to work. Sometimes, a challenges mini game like Sudoku can helps to exercise their brain and reduce stress. Besides, with the fast growing of the technologies today, most people are able to obtain the advance electronic device like PDA, laptop, and so on. So the Sudoku puzzle game is not the game that is only published in the hardcopy such as newspaper or Sudoku book. Therefore Sudoku game can be installed in their electronic device so that they can bring it anywhere. 1.2 Scope Scope of the project is generating the Sudoku puzzle with different difficulty level and solves the Sudoku game. The scope covers: Allow user to select the difficulty level of the Sudoku game. Generate a complete Sudoku puzzle by following the Sudoku rules which are the digits 1-9 appear exactly once in each row, each columns, and each 33 sub grids. Remove cells to create a valid Sudoku games according to the difficulty level that the user selected. Allow user to input the digit 1-9 into the empty cells of the puzzle. Highlight the incorrect input of digit with red colour. Solve the Sudoku games. 1.2 Objectives Understanding the algorithm behind Sudoku puzzle. Identify an algorithm to generate a complete Sudoku puzzle with the rules that the digit 1-9 appear exactly once in each row, each columns, and each 33 sub grids. Identify the ways of removing cells from the complete Sudoku puzzle to create a valid game. Generate Sudoku with different difficulty level. Identify the algorithm to solve the Sudoku puzzle. 1.3 Project Schedule Project Schedule Management Gantt Chart Tasks Activity Start date End date Duration(days) Task 1 Research and study relevant material 7/6/2010 27/6/2010 21 Task 2 Planning development process 28/6/2010 4/7/2010 7 Task 3 Implement Prototype for Generating 5/7/2010 8/8/2010 35 Task 4 Test Program and Fix error 9/8/2010 14/8/2010 7 Task 5 Amends report and prototype 15/8/2010 29/8/2010 14 Task 6 Validate interim report and Submission 30/8/2010 1/9/2010 1 Chapter 2: Literature Review 2.1 Nature of the problem Sudoku puzzle is a famous game among the worldwide. Most of the newspaper has a long history of publishing the Sudoku games such as The Times, Sin Chew Daily, and so on. The games in hardcopy required user to use pen or pencil to finish on the paper and the number of games are limited. So, in this project, a program is created to generate the Sudoku puzzle games. User does not need to use an extra writing material like pen or pencil to complete the Sudoku games. They just need a mouse to interact with the game. Other than that, the program is able to solve the Sudoku puzzle as well as identify the puzzle is solvable and have a unique solution. User also can enter the Sudoku games that are not generated by the program and solve it by using this program. 2.2 Background The origin of Sudoku is from Switzerland (By a Mathematician Leonhard Euler) and then travels to Japan by way of America. Su is the Japanese character with the meaning of number and doku means single. In another word, it called single number which means that for each column, each row, and each sub grid, it can only contain the digit 1-9 without repetition. In this project, we need to consider some important things like the cost that we need, the purpose of this project, the target user of this program and so on. Cost that we need to use is to complete the project in 24 week period. The purpose of this project is to create a program which can generate the Sudoku games with different difficulty level as well as able to solve the Sudoku games. Sudoku is a game that suitable for all generation of the people. The program is able to generate the game in 5 different difficulty levels which is very easy, easy, medium, hard, and expert. Level very easy and easy are suitable for the children, medium is suitable for the adults, hard and expert are suitable for those who are experienced in the Sudoku games. 2.3 Literature Review 2.3.1 The Science behind Sudoku Sudoku is a game of numbers, but it does not have anything to do with mathematics such as addition or multiplication. A Sudoku grid is a special kind of Latin square that named by an 18th century mathematician-Leonhard Euler. Latin square is an n x n matrices that are filled in with n symbols in a way that the same symbols appear exactly once in same row and column. The number of valid Sudoku grids is 6,670,903,752,021,072,936,960 which proved by the use of logic and computers. The minimum numbers of hints that a 9 x 9 Sudoku puzzle can start with and the solution can still remain unique seem to be 17. This mean for any Sudoku which is having the hints that less than 17 will make it cannot guarantee a unique solution. C:UsersVinZDesktop1.pngC:UsersVinZDesktop2.png Figure 1.An example of the minimal hints for a Sudoku puzzles and still guarantee with the unique solution. C:UsersVinZDesktop3.pngC:UsersVinZDesktop4.png Figure 2.An example of a Sudoku game with 16 hints provided and leads to two solutions. To solve a Sudoku puzzle, the most common way is backtracking. First, the program places a number 1 in the first empty cell of the Sudoku puzzle. If the number is compatible with the existing hints, it moves to the second empty cell and place a 1 again. When it encounters a conflict or clash with other existing hints, it erases the number which just placed and enters number 2. If it is invalid again then proceed with 3 or the next legal number. After the legal number placed, it moves to the next cell and start again with number 1. If the number that placed and it is still not compatible with the existing hints is 9 (9 is the largest number in Sudoku puzzle), the program will backtrack and increase the precious cells number by one. After that it moves forward until it is clash with other existing hints and backtracks again. Sometimes the program needs to backtrack for several times before it can move forward. Backtracking technique is good and fast when apply in a program or machine, but a human player need to spend more time to finish the game using this technique. So they used smarter ways for solving Sudoku and generally turn to method trial and error method at last of the solving part. 2.3.2 A Pencil-and-Paper Algorithm for Solving Sudoku Puzzle To solve a Sudoku puzzle, it involve with the widely known concept of matching numbers across cells. In another mathematical point of view, we name it as pre-emptive sets. The most important technique to solve the Sudoku puzzles is based on two things, which are the (i) definition of pre-emptive sets and (ii) the occupancy theorem. A mark up puzzle can help to solve the Sudoku puzzle with more efficiently by writing down the possible number that can be filled into the empty cell. C:UsersVinZDesktopmarkup.png Figure 3.Example of a mark-up Sudoku puzzle. Pre-emptive sets: A pre-emptive set composed of the digits 1-9 and is a set of size m, where: 2 {[n1, n2, , nm], [ c(i1,j1), c(i2,j2), , c(im, jm) ]} Where 1= C:UsersVinZDesktop852.png 3459 459 6 23478 1 2348 234579 24579 2345 Figure 2.Pre-emptive set For example, the figure above consist of a pre-emptive set {[3, 4, 5, 9], [c(7, 1), c(7, 2), c(8, 3), c(9, 3)]} with size 4. Occupancy theorem Suppose that x is a number that listed in the pre-emptive set and it lies completely in one column, or row, or a sub grid, so there can be no occurrence of x for the column, or row, or sub grid that outside of the pre-emptive set. Firstly, the algorithm use method 1 and method 2 to complete the puzzle until it cannot continue further. Method 1 is to figure out the Force cell which is the cell that can be determine by eliminate the impossible number (number that already existed in the same column, row and sub grid) that occupy the cell. Method 2 is to figure out the possible number for the empty cell that can be determined by checking the same number which occupies the cells in the column and row of the sub grid. After that we look for the pre-emptive set from each column, each row, and each sub grid. Try to break it into several smaller pre-emptive set and cross out the number according to the occupancy theorem. For example in Figure 2, the pre-emptive set is {[3, 4, 5, 9], [c(7, 1), c(7, 2), c(8, 3), c(9, 3)]} with size 4, it cross out the number that are not inside the pre-emptive set. In figure 2, digits 8 and 2 in cell c(8, 1) and c(9, 1) can be determined directly after the number had been crossed out. So apply again method 1 and method 2 to figure out other possible number. Clearly then, repeat again the process untill it cannot find out any pre-emptive tes ot until the sudoku puzzle is solved.if the result seem to be violated, then the sudoku game is a unsolable game. Metaheuristics can solve Sudoku puzzles Before the simulated annealing can straightforward, representation, neighbourhood operator and evaluation of candidate solution need to be defined. Representation used to assign each empty cell a value randomly, but every sub gird contain the digit 1-9 exactly once. During the process, neighbourhood operator choose two different non-fixed cells (the cell which filled in by randomly) in the sub grid and swap them. Two of the non fixed cells to be swap must be in the same sub grid to make sure the criterion of each sub grid contain the digit 1-9 exactly once. Cost function used to evaluate the candidate solution by looking at each row and column, and then calculate the number of values that are not present. For example in figure 3, 1 and 2 had repeated two times in the first row, so the score of that row is 2. Note that the complete solution of the Sudoku puzzle will have zero of cost. C:UsersVinZDesktop854.png Figure 3 Here, simulated annealing start with a candidate solution s and a neighbour s. s is accepted if s is better than s (according to cost function) or with the probability: Exp (-ÃŽÂ ´/t), which ÃŽÂ ´ = proposed change in the cost function, t = control parameter (as known as temperature). t, temperature is very important to expend the Simulated Annealing and lead to the success. The initial temperature should allow majority if the moves to be accepted, approximately 80% (according to Van Laaehoven Aart (1987)). During the process, temperature is reduced according to the simple geometric cooling schedule. A formula, = use to make sure the temperature decrease according to the cooling rate. Note that , so the largest value of is less than 1, such as 0.9999. For example, value of is 0.9999 will cause the temperature drop slowly, and the value of is 0.5 will make it drop faster. Furthermore, the use of homogenous Simulated Annealing schema takes the form of a sequence of Markov Chains that generated at the fixed value of t. The t is then changed in-between subsequent chains (Van Laarhoven and Aart, 1987). The value of t here is also very important as it decided the time to explore of the search tree and also the run times. The size of the problem-instance defined by the non-fixed number in the grid where: ml = ml = size of the problem-instance. = the function that indentify the number of cells in the are non-fixed. By using this formula, the value can allow each pair of the non-fixed cells have a good chance to considered at least once per Markov chain.

Sunday, January 19, 2020

Enders Game :: essays research papers

Orson Scott Card weaves an intricate tale of a boy who is born to save the Earth in the novel, Ender’s Game. Ender Wiggin is born a Third in a world where only two children are allowed per family. Ender’s older brother and sister, Peter and Valentine, were not what the government needed to save the world, so Ender was born in hopes that he would be somewhere in the middle of their extremes. Peter is too violent, whereas Valentine has too much empathy. Ender is the right combination for the Battle School’s needs. Although both Ender and Peter have power, only Ender has respect; both boys are instinctive killers, but Peter relishes the act while Ender regrets the act after he does it; Both boys become heroes, but both will not remain heroes when the historians begin to examine the events. Although Peter and Ender both have power over other people, the means of obtaining the power and the way each boy uses his power is different. Peter obtains power by terrifying people. Everyone knows he is capable of cold-blooded murder, so they do as he says because it is in their own best interest. Also, he has the power of influence on the nets (networks similar to the internet), which he uses to sway the public. Once Peter has gained power, he uses the power to benefit himself. He uses people as pawns to accomplish what he wants—to rule the world. Ender, however, gains his power by simply being superior at all the games. He becomes commander of an army, but doesn’t use the army to gain anything for himself, except to be number one in the standings. He makes the people in his command better soldiers by teaching them what he knows. He allows the toon leaders to make decisions in battles, so that the whole army doesn’t rely on him, entirely. Both Peter and Ender kill throughout the novel. Peter kills innocent squirrels and animals. He threatens to kill Ender and Valentine if they do not do as he says. It is quite clear that he enjoys these activities. He shows no remorse for the dead animals he leaves in his wake. Ender, however, kills out of defense and feels great remorse. He never intends to kill anyone that he kills. All the deaths he inflicts are accidental, yet justified at the same time.

Saturday, January 11, 2020

Gender Equality in Beowulf

Woman had political power over the Danes, were used as peace weavers, and were very violent, and strong. The importance of women in Beowulf can be seen through the political power that the women had on the Danes. In the poem, the author introduces two queens, named Wealthiest and High. Both of them developed an important role of being the hostesses. Although, they pleased and served men whenever they needed, Wealthiest and High had enough power to establish a hierarchy in the hall. Having to carry the cups around in order to give it to the king, and his warriors was not a simple task for women.When Whole-wheat first appeared in the poem, â€Å"she graciously saluted the men in hall, then handed the cup]first to Warthogs, their homeland's guardian, urging him to drink deep and enjoy desiccates he was dear to them† (43), the queen is making it clear that Warthogs is the most powerful king in the hall, by handing him the first feasting cup. High tries to convince Beowulf to take the position as king, because she â€Å"had no belief in her son's ability;to defend their homeland against foreign invaders.Yet there was no way the weakened nation Could get Beowulf to give in and agree Tot be elevated over Heard s his lord† (161), women had power when it came to politics, because they were aware of what was going on. High began to make important decisions of who will become the next king, and her decisions could change everyone's lives. Women were highly significant through their role of being peace weavers, because men were able to use them as a form of possession.The author introduces Hilbert, and Freeware, both women who had to marry a man from a rival group in order for peace to be established between the tribes. Hilbert, and Freeware did not marry because they were in love, but simply or convenience, since the tribes believed this would help them gain amity. Hilbert was the first woman that was introduced as a peace weaver, â€Å"a Danish princess ma rried to the Frisian King Finn, loses her son and her brother Hanna in a fight at Fin's hall† (71), Hilbert was first mentioned in a story that was performed by the kings poet after Grenade's death.Then, Freeware was introduced through a story that was told by Beowulf. â€Å"Most often after the fall of a prince in any nation the deadly spear rests but a little while, even thought the bride is good† (35), Beowulf is predicting that Freeware will marry in order to create peace, and believes that peace- weavers will soon create hardships and war. Women can behave just as violently, and can be just as strong as any men they have encountered. Grenade's mother and Motherly are the perfect representation of powerful women in Beowulf.Grenade's mother was very fearless, because she â€Å"had been forced down into fearful waters, the cold depths, after Cain had shellfish father's son, felled his ownÃ'Å¡brother with a sword† (89). After the assassination of her son, she de cided to seek vengeance, rather than forgetting the incident ever happened. Grenade's mother died while fighting with Beowulf, because she wanted to gain back her sons honor. Then there was the Great Queen Motherly, the one that was capable of anything. If any retainer ever made blotto look her in the face, if an eye not her lord's;stared at her directly during daylight,;the outcome was sealed: he was kept abounding hand-tightened shackles† (1 33), many people were afraid of her because she was known for murdering many innocent man who have entered her hall, or even looked her in the eye. Even though they were both physically different, they were very powerful and strong women. In conclusion, women have always been an important part of society even though they are not vastly appreciated.

Friday, January 3, 2020

Corporate Social Responsibility Of Cigna Corporation

Cigna Corporation is a global health service company dedicated to helping people improve their health, well-being and sense of security. Cigna Corporation is in over 30 countries and jurisdictions and has over 89 million members throughout the world. (CSR Profile of Cigna Corporation, 2015). This essay we will review Cigna Corporation social responsibility, to see if they contribute to society through good business practices, by providing good work environment, good citizenship and solving social issues. We will incorporate terms such as sustainability, strategic philanthropy, cause marketing, shared value, stakeholders, and global perspective. We will see if Cigna Corporation really following the corporation social responsibility of the†¦show more content†¦(Cigna Connect Corporate Responsibility Report, 2014) Cigna Foundation has been carrying out corporate philanthropy for over 50 years. This is only a part of their social corporate responsibility and their goal. Cigna corporate philanthropy goal is to bring Cigna’s mission and brand promise to individual and communities around the globe. (CSR Profile of Cigna Corporation, 2015). The foundation has been able to accomplish their goals by focusing on charities and nonprofit organization that has enhanced the health of individuals and their families. , which has health to bring well being to the community. This foundation has shown us that their responsibility has gone beyond economic and legal obligation; they have show the community that they can volunteer in the community; give donations to nonprofits, and just sharing their given talent to help others. Cigna foundation cause marketing is a part of the philanthropy that contributes to the purchase of products. The purchase of the product will help to raise funds for the nonprofits or the charity as well as the awareness of the organization. When the social responsibility and profit combine we have a shared value. In 2013 Cigna came up with a campaign for Cigna and society. The goal was to include, reduce waste, by shredding paper, and recycle ink and toner cartridges as well as cans and plastic. The