├── .gitignore ├── CODE_OF_CONDUCT.md ├── LICENSE ├── README.md ├── hangman ├── C# │ ├── .gitignore │ ├── Hangman │ │ ├── .gitignore │ │ ├── App.config │ │ ├── Hangman.csproj │ │ ├── Hangman.sln │ │ ├── Program.cs │ │ ├── Properties │ │ │ └── AssemblyInfo.cs │ │ └── resources │ │ │ └── words.in │ └── README.md ├── C++ │ ├── .gitignore │ ├── README.md │ └── hangman │ │ ├── main.cpp │ │ └── resources │ │ └── words.in ├── C │ ├── .gitignore │ ├── README.md │ └── hangman │ │ └── resources │ │ ├── main.c │ │ └── words.in ├── Go │ ├── README.md │ ├── hangman.go │ └── resources │ │ └── words.in ├── Groovy │ ├── pom.xml │ └── src │ │ └── main │ │ ├── groovy │ │ └── com │ │ │ └── floppylab │ │ │ └── refactor │ │ │ └── Hangman.groovy │ │ └── resources │ │ └── words.in ├── Java │ ├── README.md │ ├── pom.xml │ └── src │ │ └── main │ │ ├── java │ │ └── com │ │ │ └── floppylab │ │ │ └── refactor │ │ │ └── Hangman.java │ │ └── resources │ │ └── words.in ├── JavaScript │ ├── .gitignore │ ├── .nvmrc │ ├── hangman.js │ ├── package-lock.json │ ├── package.json │ ├── readme.md │ └── resources │ │ └── words.in ├── Kotlin │ ├── README.md │ ├── hangman.kt │ └── resources │ │ └── words.in ├── Python │ └── Hangman │ │ ├── .gitignore │ │ ├── Hangman.py │ │ ├── README.md │ │ └── resources │ │ └── words.in ├── README.md └── Rust │ ├── .gitignore │ ├── Cargo.toml │ ├── resources │ └── words.in │ └── src │ └── main.rs └── matchsticks ├── C++ ├── README.md └── matchsticks.cpp ├── C ├── .gitignore ├── README.md └── matchsticks.c ├── Java ├── README.md └── matchsticks │ ├── .gitignore │ ├── pom.xml │ └── src │ ├── main │ └── java │ │ └── floppylab │ │ └── matchsticks │ │ └── Matchsticks.java │ └── test │ └── java │ └── floppylab │ └── matchsticks │ └── MatchsticksTest.java ├── JavaScript ├── README.md └── matchsticks.js ├── Kotlin ├── README.md └── matchsticks.kt └── README.md /.gitignore: -------------------------------------------------------------------------------- 1 | /node_modules -------------------------------------------------------------------------------- /CODE_OF_CONDUCT.md: -------------------------------------------------------------------------------- 1 | # Contributor Covenant Code of Conduct 2 | 3 | ## Our Pledge 4 | 5 | In the interest of fostering an open and welcoming environment, we as contributors and maintainers pledge to making participation in our project and our community a harassment-free experience for everyone, regardless of age, body size, disability, ethnicity, gender identity and expression, level of experience, nationality, personal appearance, race, religion, or sexual identity and orientation. 6 | 7 | ## Our Standards 8 | 9 | Examples of behavior that contributes to creating a positive environment include: 10 | 11 | * Using welcoming and inclusive language 12 | * Being respectful of differing viewpoints and experiences 13 | * Gracefully accepting constructive criticism 14 | * Focusing on what is best for the community 15 | * Showing empathy towards other community members 16 | 17 | Examples of unacceptable behavior by participants include: 18 | 19 | * The use of sexualized language or imagery and unwelcome sexual attention or advances 20 | * Trolling, insulting/derogatory comments, and personal or political attacks 21 | * Public or private harassment 22 | * Publishing others' private information, such as a physical or electronic address, without explicit permission 23 | * Other conduct which could reasonably be considered inappropriate in a professional setting 24 | 25 | ## Our Responsibilities 26 | 27 | Project maintainers are responsible for clarifying the standards of acceptable behavior and are expected to take appropriate and fair corrective action in response to any instances of unacceptable behavior. 28 | 29 | Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, or to ban temporarily or permanently any contributor for other behaviors that they deem inappropriate, threatening, offensive, or harmful. 30 | 31 | ## Scope 32 | 33 | This Code of Conduct applies both within project spaces and in public spaces when an individual is representing the project or its community. Examples of representing a project or community include using an official project e-mail address, posting via an official social media account, or acting as an appointed representative at an online or offline event. Representation of a project may be further defined and clarified by project maintainers. 34 | 35 | ## Enforcement 36 | 37 | Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by contacting the project team at info@floppylab.com. The project team will review and investigate all complaints, and will respond in a way that it deems appropriate to the circumstances. The project team is obligated to maintain confidentiality with regard to the reporter of an incident. Further details of specific enforcement policies may be posted separately. 38 | 39 | Project maintainers who do not follow or enforce the Code of Conduct in good faith may face temporary or permanent repercussions as determined by other members of the project's leadership. 40 | 41 | ## Attribution 42 | 43 | This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4, available at [http://contributor-covenant.org/version/1/4][version] 44 | 45 | [homepage]: http://contributor-covenant.org 46 | [version]: http://contributor-covenant.org/version/1/4/ 47 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Apache License 2 | Version 2.0, January 2004 3 | http://www.apache.org/licenses/ 4 | 5 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 6 | 7 | 1. Definitions. 8 | 9 | "License" shall mean the terms and conditions for use, reproduction, 10 | and distribution as defined by Sections 1 through 9 of this document. 11 | 12 | "Licensor" shall mean the copyright owner or entity authorized by 13 | the copyright owner that is granting the License. 14 | 15 | "Legal Entity" shall mean the union of the acting entity and all 16 | other entities that control, are controlled by, or are under common 17 | control with that entity. For the purposes of this definition, 18 | "control" means (i) the power, direct or indirect, to cause the 19 | direction or management of such entity, whether by contract or 20 | otherwise, or (ii) ownership of fifty percent (50%) or more of the 21 | outstanding shares, or (iii) beneficial ownership of such entity. 22 | 23 | "You" (or "Your") shall mean an individual or Legal Entity 24 | exercising permissions granted by this License. 25 | 26 | "Source" form shall mean the preferred form for making modifications, 27 | including but not limited to software source code, documentation 28 | source, and configuration files. 29 | 30 | "Object" form shall mean any form resulting from mechanical 31 | transformation or translation of a Source form, including but 32 | not limited to compiled object code, generated documentation, 33 | and conversions to other media types. 34 | 35 | "Work" shall mean the work of authorship, whether in Source or 36 | Object form, made available under the License, as indicated by a 37 | copyright notice that is included in or attached to the work 38 | (an example is provided in the Appendix below). 39 | 40 | "Derivative Works" shall mean any work, whether in Source or Object 41 | form, that is based on (or derived from) the Work and for which the 42 | editorial revisions, annotations, elaborations, or other modifications 43 | represent, as a whole, an original work of authorship. For the purposes 44 | of this License, Derivative Works shall not include works that remain 45 | separable from, or merely link (or bind by name) to the interfaces of, 46 | the Work and Derivative Works thereof. 47 | 48 | "Contribution" shall mean any work of authorship, including 49 | the original version of the Work and any modifications or additions 50 | to that Work or Derivative Works thereof, that is intentionally 51 | submitted to Licensor for inclusion in the Work by the copyright owner 52 | or by an individual or Legal Entity authorized to submit on behalf of 53 | the copyright owner. For the purposes of this definition, "submitted" 54 | means any form of electronic, verbal, or written communication sent 55 | to the Licensor or its representatives, including but not limited to 56 | communication on electronic mailing lists, source code control systems, 57 | and issue tracking systems that are managed by, or on behalf of, the 58 | Licensor for the purpose of discussing and improving the Work, but 59 | excluding communication that is conspicuously marked or otherwise 60 | designated in writing by the copyright owner as "Not a Contribution." 61 | 62 | "Contributor" shall mean Licensor and any individual or Legal Entity 63 | on behalf of whom a Contribution has been received by Licensor and 64 | subsequently incorporated within the Work. 65 | 66 | 2. Grant of Copyright License. Subject to the terms and conditions of 67 | this License, each Contributor hereby grants to You a perpetual, 68 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 69 | copyright license to reproduce, prepare Derivative Works of, 70 | publicly display, publicly perform, sublicense, and distribute the 71 | Work and such Derivative Works in Source or Object form. 72 | 73 | 3. Grant of Patent License. Subject to the terms and conditions of 74 | this License, each Contributor hereby grants to You a perpetual, 75 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 76 | (except as stated in this section) patent license to make, have made, 77 | use, offer to sell, sell, import, and otherwise transfer the Work, 78 | where such license applies only to those patent claims licensable 79 | by such Contributor that are necessarily infringed by their 80 | Contribution(s) alone or by combination of their Contribution(s) 81 | with the Work to which such Contribution(s) was submitted. If You 82 | institute patent litigation against any entity (including a 83 | cross-claim or counterclaim in a lawsuit) alleging that the Work 84 | or a Contribution incorporated within the Work constitutes direct 85 | or contributory patent infringement, then any patent licenses 86 | granted to You under this License for that Work shall terminate 87 | as of the date such litigation is filed. 88 | 89 | 4. Redistribution. You may reproduce and distribute copies of the 90 | Work or Derivative Works thereof in any medium, with or without 91 | modifications, and in Source or Object form, provided that You 92 | meet the following conditions: 93 | 94 | (a) You must give any other recipients of the Work or 95 | Derivative Works a copy of this License; and 96 | 97 | (b) You must cause any modified files to carry prominent notices 98 | stating that You changed the files; and 99 | 100 | (c) You must retain, in the Source form of any Derivative Works 101 | that You distribute, all copyright, patent, trademark, and 102 | attribution notices from the Source form of the Work, 103 | excluding those notices that do not pertain to any part of 104 | the Derivative Works; and 105 | 106 | (d) If the Work includes a "NOTICE" text file as part of its 107 | distribution, then any Derivative Works that You distribute must 108 | include a readable copy of the attribution notices contained 109 | within such NOTICE file, excluding those notices that do not 110 | pertain to any part of the Derivative Works, in at least one 111 | of the following places: within a NOTICE text file distributed 112 | as part of the Derivative Works; within the Source form or 113 | documentation, if provided along with the Derivative Works; or, 114 | within a display generated by the Derivative Works, if and 115 | wherever such third-party notices normally appear. The contents 116 | of the NOTICE file are for informational purposes only and 117 | do not modify the License. You may add Your own attribution 118 | notices within Derivative Works that You distribute, alongside 119 | or as an addendum to the NOTICE text from the Work, provided 120 | that such additional attribution notices cannot be construed 121 | as modifying the License. 122 | 123 | You may add Your own copyright statement to Your modifications and 124 | may provide additional or different license terms and conditions 125 | for use, reproduction, or distribution of Your modifications, or 126 | for any such Derivative Works as a whole, provided Your use, 127 | reproduction, and distribution of the Work otherwise complies with 128 | the conditions stated in this License. 129 | 130 | 5. Submission of Contributions. Unless You explicitly state otherwise, 131 | any Contribution intentionally submitted for inclusion in the Work 132 | by You to the Licensor shall be under the terms and conditions of 133 | this License, without any additional terms or conditions. 134 | Notwithstanding the above, nothing herein shall supersede or modify 135 | the terms of any separate license agreement you may have executed 136 | with Licensor regarding such Contributions. 137 | 138 | 6. Trademarks. This License does not grant permission to use the trade 139 | names, trademarks, service marks, or product names of the Licensor, 140 | except as required for reasonable and customary use in describing the 141 | origin of the Work and reproducing the content of the NOTICE file. 142 | 143 | 7. Disclaimer of Warranty. Unless required by applicable law or 144 | agreed to in writing, Licensor provides the Work (and each 145 | Contributor provides its Contributions) on an "AS IS" BASIS, 146 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 147 | implied, including, without limitation, any warranties or conditions 148 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A 149 | PARTICULAR PURPOSE. You are solely responsible for determining the 150 | appropriateness of using or redistributing the Work and assume any 151 | risks associated with Your exercise of permissions under this License. 152 | 153 | 8. Limitation of Liability. In no event and under no legal theory, 154 | whether in tort (including negligence), contract, or otherwise, 155 | unless required by applicable law (such as deliberate and grossly 156 | negligent acts) or agreed to in writing, shall any Contributor be 157 | liable to You for damages, including any direct, indirect, special, 158 | incidental, or consequential damages of any character arising as a 159 | result of this License or out of the use or inability to use the 160 | Work (including but not limited to damages for loss of goodwill, 161 | work stoppage, computer failure or malfunction, or any and all 162 | other commercial damages or losses), even if such Contributor 163 | has been advised of the possibility of such damages. 164 | 165 | 9. Accepting Warranty or Additional Liability. While redistributing 166 | the Work or Derivative Works thereof, You may choose to offer, 167 | and charge a fee for, acceptance of support, warranty, indemnity, 168 | or other liability obligations and/or rights consistent with this 169 | License. However, in accepting such obligations, You may act only 170 | on Your own behalf and on Your sole responsibility, not on behalf 171 | of any other Contributor, and only if You agree to indemnify, 172 | defend, and hold each Contributor harmless for any liability 173 | incurred by, or claims asserted against, such Contributor by reason 174 | of your accepting any such warranty or additional liability. 175 | 176 | END OF TERMS AND CONDITIONS 177 | 178 | APPENDIX: How to apply the Apache License to your work. 179 | 180 | To apply the Apache License to your work, attach the following 181 | boilerplate notice, with the fields enclosed by brackets "[]" 182 | replaced with your own identifying information. (Don't include 183 | the brackets!) The text should be enclosed in the appropriate 184 | comment syntax for the file format. We also recommend that a 185 | file or class name and description of purpose be included on the 186 | same "printed page" as the copyright notice for easier 187 | identification within third-party archives. 188 | 189 | Copyright 2018 floppylab 190 | 191 | Licensed under the Apache License, Version 2.0 (the "License"); 192 | you may not use this file except in compliance with the License. 193 | You may obtain a copy of the License at 194 | 195 | http://www.apache.org/licenses/LICENSE-2.0 196 | 197 | Unless required by applicable law or agreed to in writing, software 198 | distributed under the License is distributed on an "AS IS" BASIS, 199 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 200 | See the License for the specific language governing permissions and 201 | limitations under the License. 202 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # A collection of pieces of code to practice refactoring 2 | 3 | You can find pieces of simple programs here you can work on. These will help you to improve your refactoring skills. 4 | 5 | ## Collection 6 | 7 | - [Hangman](hangman) 8 | - [Matchsticks](matchsticks) 9 | -------------------------------------------------------------------------------- /hangman/C#/.gitignore: -------------------------------------------------------------------------------- 1 | # MS Visual Studio 2 | *.suo 3 | *.csproj.user -------------------------------------------------------------------------------- /hangman/C#/Hangman/.gitignore: -------------------------------------------------------------------------------- 1 | bin/ 2 | obj/ -------------------------------------------------------------------------------- /hangman/C#/Hangman/App.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /hangman/C#/Hangman/Hangman.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | Debug 6 | AnyCPU 7 | {1769ED1B-D62A-45A7-AB21-3CBB2DDE2180} 8 | Exe 9 | Properties 10 | Hangman 11 | Hangman 12 | v4.5.2 13 | 512 14 | true 15 | 16 | 17 | AnyCPU 18 | true 19 | full 20 | false 21 | bin\Debug\ 22 | DEBUG;TRACE 23 | prompt 24 | 4 25 | 26 | 27 | AnyCPU 28 | pdbonly 29 | true 30 | bin\Release\ 31 | TRACE 32 | prompt 33 | 4 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 61 | -------------------------------------------------------------------------------- /hangman/C#/Hangman/Hangman.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio 15 4 | VisualStudioVersion = 15.0.28010.2046 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Hangman", "Hangman.csproj", "{1769ED1B-D62A-45A7-AB21-3CBB2DDE2180}" 7 | EndProject 8 | Global 9 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 10 | Debug|Any CPU = Debug|Any CPU 11 | Release|Any CPU = Release|Any CPU 12 | EndGlobalSection 13 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 14 | {1769ED1B-D62A-45A7-AB21-3CBB2DDE2180}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 15 | {1769ED1B-D62A-45A7-AB21-3CBB2DDE2180}.Debug|Any CPU.Build.0 = Debug|Any CPU 16 | {1769ED1B-D62A-45A7-AB21-3CBB2DDE2180}.Release|Any CPU.ActiveCfg = Release|Any CPU 17 | {1769ED1B-D62A-45A7-AB21-3CBB2DDE2180}.Release|Any CPU.Build.0 = Release|Any CPU 18 | EndGlobalSection 19 | GlobalSection(SolutionProperties) = preSolution 20 | HideSolutionNode = FALSE 21 | EndGlobalSection 22 | GlobalSection(ExtensibilityGlobals) = postSolution 23 | SolutionGuid = {9142AE20-9C6F-491E-90DE-EF444BB5F0B1} 24 | EndGlobalSection 25 | EndGlobal 26 | -------------------------------------------------------------------------------- /hangman/C#/Hangman/Program.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.IO; 4 | using System.Linq; 5 | 6 | namespace Hangman 7 | { 8 | class Program 9 | { 10 | static void Main(string[] args) 11 | { 12 | Dictionary> d = new Dictionary>(); 13 | List w = new List(); 14 | 15 | var wordsPath = Directory.GetParent(Directory.GetCurrentDirectory()).Parent?.FullName + @"\resources\words.in"; 16 | string line; 17 | 18 | // reading text file line by line 19 | using (StreamReader reader = new StreamReader(wordsPath)) 20 | { 21 | while ((line = reader.ReadLine()) != null) 22 | { 23 | w.Add(line); 24 | } 25 | } 26 | 27 | // sorting words by length 28 | for (int i = 0; i < w.Count; i++) 29 | { 30 | if (!d.ContainsKey(w[i].Length)) 31 | { 32 | d.Add(w[i].Length, new List()); 33 | } 34 | d[w[i].Length].Add(w[i]); 35 | } 36 | 37 | 38 | 39 | int userInputNumOfLetters; 40 | while (true) 41 | { 42 | Console.WriteLine("Number of letters in the word? "); 43 | userInputNumOfLetters = Convert.ToInt32(Console.ReadLine()); 44 | if (userInputNumOfLetters < 6) 45 | { 46 | Console.Clear(); 47 | Console.WriteLine("Please enter a word length 6 or more"); 48 | } 49 | else if (userInputNumOfLetters > 14) 50 | { 51 | Console.Clear(); 52 | Console.WriteLine("Please enter a word length 14 or less"); 53 | } 54 | else 55 | { 56 | break; 57 | } 58 | } 59 | 60 | if (d.ContainsKey(userInputNumOfLetters)) 61 | { 62 | // choose a random word with the given length 63 | string word = d[userInputNumOfLetters][new Random().Next(d[userInputNumOfLetters].Count)]; 64 | bool[] v = new bool[word.Length]; 65 | int e = 0; 66 | bool done = true; 67 | 68 | while (e < 10) 69 | { 70 | 71 | done = true; 72 | for (int i = 0; i < word.Length; ++i) 73 | { 74 | if (!v[i]) 75 | { 76 | done = false; 77 | } 78 | } 79 | if (done) 80 | { 81 | break; 82 | } 83 | 84 | Console.WriteLine("Guess a letter: "); 85 | char chr = Convert.ToChar(Console.ReadLine()[0]); 86 | 87 | // TODO check if previously entered 88 | bool hit = false; 89 | for (int i = 0; i < word.Length; ++i) 90 | { 91 | if (word[i] == chr && !v[i]) 92 | { 93 | v[i] = true; 94 | hit = true; 95 | } 96 | } 97 | if (hit) 98 | { 99 | Console.WriteLine("Hit!"); 100 | } 101 | else { 102 | Console.WriteLine("Missed, mistake {0} out of {1}", e+1, 10); 103 | ++e; 104 | 105 | // drawing hangman 106 | Console.WriteLine(); 107 | if (e > 2) Console.WriteLine(" xxxxxxxxxxxxx"); 108 | else Console.WriteLine(); 109 | 110 | if (e > 3) Console.WriteLine(" x x"); 111 | else if (e > 1) Console.WriteLine(" x"); 112 | else Console.WriteLine(); 113 | 114 | if (e > 3) Console.WriteLine(" x x"); 115 | else if (e > 1) Console.WriteLine(" x"); 116 | else Console.WriteLine(); 117 | 118 | if (e > 4) Console.WriteLine(" xxx x"); 119 | else if (e > 1) Console.WriteLine(" x"); 120 | else Console.WriteLine(); 121 | 122 | if (e > 4) Console.WriteLine(" xxxxx x"); 123 | else if (e > 1) Console.WriteLine(" x"); 124 | else Console.WriteLine(); 125 | 126 | if (e > 4) Console.WriteLine(" xxx x"); 127 | else if (e > 1) Console.WriteLine(" x"); 128 | else Console.WriteLine(); 129 | 130 | if (e > 5) Console.WriteLine(" x x"); 131 | else if (e > 1) Console.WriteLine(" x"); 132 | else Console.WriteLine(); 133 | 134 | if (e > 7) Console.WriteLine(" x x x x"); 135 | else if (e > 6) Console.WriteLine(" x x x"); 136 | else if (e > 5) Console.WriteLine(" x x"); 137 | else if (e > 1) Console.WriteLine(" x"); 138 | else Console.WriteLine(); 139 | 140 | if (e > 7) Console.WriteLine(" x x x x"); 141 | else if (e > 6) Console.WriteLine(" x x x"); 142 | else if (e > 5) Console.WriteLine(" x x"); 143 | else if (e > 1) Console.WriteLine(" x"); 144 | else Console.WriteLine(); 145 | 146 | if (e > 5) Console.WriteLine(" x x"); 147 | else if (e > 1) Console.WriteLine(" x"); 148 | else Console.WriteLine(); 149 | 150 | if (e > 9) Console.WriteLine(" x x x"); 151 | else if (e > 8) Console.WriteLine(" x x"); 152 | else if (e > 1) Console.WriteLine(" x"); 153 | else Console.WriteLine(); 154 | 155 | if (e > 9) Console.WriteLine(" x x x"); 156 | else if (e > 8) Console.WriteLine(" x x"); 157 | else if (e > 1) Console.WriteLine(" x"); 158 | else Console.WriteLine(); 159 | 160 | if (e > 1) Console.WriteLine(" x"); 161 | else Console.WriteLine(); 162 | 163 | if (e > 1) Console.WriteLine(" x"); 164 | else Console.WriteLine(); 165 | 166 | if (e > 0) Console.WriteLine("xxxxxxxxxxxxxxxxxxxxxxxxxxxx"); 167 | else Console.WriteLine(); 168 | Console.WriteLine(); 169 | 170 | } 171 | Console.Write("The word: "); 172 | 173 | for (int i = 0; i < word.Length; ++i) 174 | { 175 | if (v[i]) 176 | { 177 | Console.Write(" " + word[i] + " "); 178 | } 179 | else { 180 | Console.Write(" _ "); 181 | } 182 | } 183 | Console.WriteLine(); 184 | } 185 | 186 | // printing final result 187 | if (done) 188 | { 189 | Console.WriteLine("You won!"); 190 | } 191 | else { 192 | Console.WriteLine("You lost."); 193 | Console.WriteLine("The word was: " + word); 194 | } 195 | } 196 | else 197 | { 198 | Console.WriteLine("Sorry, no words like that."); 199 | } 200 | 201 | } 202 | } 203 | } 204 | -------------------------------------------------------------------------------- /hangman/C#/Hangman/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // General Information about an assembly is controlled through the following 6 | // set of attributes. Change these attribute values to modify the information 7 | // associated with an assembly. 8 | [assembly: AssemblyTitle("Hangman")] 9 | [assembly: AssemblyDescription("")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("")] 12 | [assembly: AssemblyProduct("Hangman")] 13 | [assembly: AssemblyCopyright("Copyright © 2018")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // Setting ComVisible to false makes the types in this assembly not visible 18 | // to COM components. If you need to access a type in this assembly from 19 | // COM, set the ComVisible attribute to true on that type. 20 | [assembly: ComVisible(false)] 21 | 22 | // The following GUID is for the ID of the typelib if this project is exposed to COM 23 | [assembly: Guid("1769ed1b-d62a-45a7-ab21-3cbb2dde2180")] 24 | 25 | // Version information for an assembly consists of the following four values: 26 | // 27 | // Major Version 28 | // Minor Version 29 | // Build Number 30 | // Revision 31 | // 32 | // You can specify all the values or you can default the Build and Revision Numbers 33 | // by using the '*' as shown below: 34 | // [assembly: AssemblyVersion("1.0.*")] 35 | [assembly: AssemblyVersion("1.0.0.0")] 36 | [assembly: AssemblyFileVersion("1.0.0.0")] 37 | -------------------------------------------------------------------------------- /hangman/C#/README.md: -------------------------------------------------------------------------------- 1 | To compile, you need Visual Studio or Mono installed. 2 | 3 | * Use Visual Studio to compile your project 4 | * Use command line: ```csc Hangman/Program.cs``` 5 | 6 | To run, on the command line run the command ```mono Program.exe``` on Unix or ```.\Program.exe``` on Windows. 7 | -------------------------------------------------------------------------------- /hangman/C++/.gitignore: -------------------------------------------------------------------------------- 1 | *.o 2 | *.exe 3 | *.out 4 | -------------------------------------------------------------------------------- /hangman/C++/README.md: -------------------------------------------------------------------------------- 1 | To compile, you need GCC or Clang installed. 2 | The compiler must at a minimum support C++11. 3 | 4 | * gcc: ```g++ hangman/main.cpp``` 5 | * clang: ```clang++ hangman/main.cpp``` 6 | 7 | * To change the name of output file (a.out by default) ```g++ -o output_file_name main.cpp``` 8 | 9 | To run, on the command line run the command ```./a.out``` on Unix or ```.\a.exe``` on Windows. 10 | -------------------------------------------------------------------------------- /hangman/C++/hangman/main.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | #include 6 | #include 7 | #include 8 | 9 | int main(int argc, char** argv) 10 | { 11 | std::vector w; 12 | std::map> d; 13 | std::string line; 14 | 15 | try 16 | { 17 | std::fstream reader("./resources/words.in"); 18 | 19 | // reading text file line by line 20 | while(std::getline(reader, line)) 21 | { 22 | w.push_back(line); 23 | } 24 | 25 | // sorting words by length 26 | for (size_t i = 0; i < w.size(); i++) 27 | { 28 | if (d.find(w[i].size()) == d.end()) 29 | { 30 | d[w[i].size()] = std::vector(); 31 | } 32 | d[w[i].size()].push_back(w[i]); 33 | } 34 | 35 | std::cout << "Number of letters in the word? "; 36 | int l; 37 | std::cin >> l; 38 | 39 | if (d.find(l) != d.end()) 40 | { 41 | // Note: On windows when using mingw, this will always return the same pattern. 42 | // https://stackoverflow.com/questions/18880654/why-do-i-get-the-same-sequence-for-every-run-with-stdrandom-device-with-mingw 43 | // Use MSVC, Clang, or GCC on Linux to get around this. 44 | std::random_device rd; 45 | std::mt19937_64 gen(rd()); 46 | 47 | std::uniform_int_distribution rng(0, d[l].size()); 48 | 49 | std::string word = d[l][rng(gen)]; 50 | 51 | std::vector v(word.size()); 52 | int e = 0; 53 | bool done = true; 54 | 55 | while (e < 10) 56 | { 57 | done = true; 58 | for (size_t i = 0; i < word.size(); ++i) 59 | { 60 | if(!v[i]) 61 | { 62 | done = false; 63 | } 64 | } 65 | if (done) 66 | { 67 | break; 68 | } 69 | 70 | std::cout << "Guess a letter: "; 71 | char chr; 72 | std::cin >> chr; 73 | 74 | // TODO check if previously entered. 75 | bool hit = false; 76 | for (size_t i = 0; i < word.size(); ++i) 77 | { 78 | if (word[i] == chr && !v[i]) 79 | { 80 | v[i] = true; 81 | hit = true; 82 | } 83 | } 84 | 85 | if (hit) 86 | { 87 | std::cout << "Hit!" << std::endl; 88 | } 89 | else 90 | { 91 | std::cout << "Missed, mistake " << e + 1 << " out of " << 10 << std::endl; 92 | ++e; 93 | 94 | // drawing hangman 95 | std::cout << std::endl; 96 | if (e>2) std::cout << " xxxxxxxxxxxxx" << std::endl; 97 | else std::cout << std::endl; 98 | 99 | if (e>3) std::cout << " x x" << std::endl; 100 | else if (e > 1) std::cout << " x" << std::endl; 101 | else std::cout << std::endl; 102 | 103 | if(e>3) std::cout << " x x" << std::endl; 104 | else if (e > 1) std::cout << " x" << std::endl; 105 | else std::cout << std::endl; 106 | 107 | if(e>4) std::cout << " xxx x" << std::endl; 108 | else if (e > 1) std::cout << " x" << std::endl; 109 | else std::cout << std::endl; 110 | 111 | if(e>4) std::cout << " xxxxx x" << std::endl; 112 | else if (e > 1) std::cout << " x" << std::endl; 113 | else std::cout << std::endl; 114 | 115 | if(e>4) std::cout << " xxx x" << std::endl; 116 | else if (e > 1) std::cout << " x" << std::endl; 117 | else std::cout << std::endl; 118 | 119 | if(e>5) std::cout << " x x" << std::endl; 120 | else if (e > 1) std::cout << " x" << std::endl; 121 | else std::cout << std::endl; 122 | 123 | if(e>7) std::cout << " x x x x" << std::endl; 124 | else if(e>6) std::cout << " x x x" << std::endl; 125 | else if(e>5) std::cout << " x x" << std::endl; 126 | else if (e > 1) std::cout << " x" << std::endl; 127 | else std::cout << std::endl; 128 | 129 | if(e>7) std::cout << " x x x x" << std::endl; 130 | else if(e>6) std::cout << " x x x" << std::endl; 131 | else if(e>5) std::cout << " x x" << std::endl; 132 | else if (e > 1) std::cout << " x" << std::endl; 133 | else std::cout << std::endl; 134 | 135 | if(e>5) std::cout << " x x" << std::endl; 136 | else if (e > 1) std::cout << " x" << std::endl; 137 | else std::cout << std::endl; 138 | 139 | if(e>9) std::cout << " x x x" << std::endl; 140 | else if(e>8) std::cout << " x x" << std::endl; 141 | else if (e > 1) std::cout << " x" << std::endl; 142 | else std::cout << std::endl; 143 | 144 | if(e>9) std::cout << " x x x" << std::endl; 145 | else if(e>8) std::cout << " x x" << std::endl; 146 | else if (e > 1) std::cout << " x" << std::endl; 147 | else std::cout << std::endl; 148 | 149 | if(e>1) std::cout << " x" << std::endl; 150 | else std::cout << std::endl; 151 | 152 | if(e>1) std::cout << " x" << std::endl; 153 | else std::cout << std::endl; 154 | 155 | if(e>0) std::cout << "xxxxxxxxxxxxxxxxxxxxxxxxxxxx" << std::endl; 156 | else std::cout << std::endl; 157 | std::cout << std::endl; 158 | } 159 | 160 | std::cout << "The word: "; 161 | for (size_t i = 0; i < word.size(); ++i) 162 | { 163 | if (v[i]) 164 | { 165 | std::cout << " " << word[i] << " "; 166 | } 167 | else 168 | { 169 | std::cout << " _ "; 170 | } 171 | } 172 | 173 | std::cout << std::endl << std::endl; 174 | } 175 | 176 | // printing final result 177 | if (done) 178 | { 179 | std::cout << "You won!" << std::endl; 180 | } 181 | else 182 | { 183 | std::cout << "You lost." << std::endl; 184 | std::cout << "The word was: " << word << std::endl; 185 | } 186 | } 187 | else 188 | { 189 | std::cout << "Sorry, no words like that." << std::endl; 190 | } 191 | } 192 | catch(const std::exception &e) 193 | { 194 | // TODO nice exception catching. 195 | std::cout << e.what() << std::endl; 196 | } 197 | } -------------------------------------------------------------------------------- /hangman/C/.gitignore: -------------------------------------------------------------------------------- 1 | *.o 2 | *.exe 3 | *.out -------------------------------------------------------------------------------- /hangman/C/README.md: -------------------------------------------------------------------------------- 1 | To compile, you need GCC or Clang installed. 2 | 3 | * gcc: ```gcc hangman/resources/main.c``` 4 | * clang: ```clang hangman/resources/main.c``` 5 | 6 | To run, on the command line run the command ```./a.out``` on Unix or ```.\a.exe``` on Windows. 7 | -------------------------------------------------------------------------------- /hangman/C/hangman/resources/main.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | 10 | int main(int argc, char** argv) 11 | { 12 | std::vector w; 13 | std::map> d; 14 | std::string line; 15 | 16 | 17 | std::fstream reader("./resources/words.in"); 18 | 19 | // reading text file line by line 20 | while(std::getline(reader, line)) 21 | { 22 | w.push_back(line); 23 | } 24 | 25 | // sorting words by length 26 | for (size_t i = 0; i < w.size(); i++) 27 | { 28 | if (d.find(w[i].size()) == d.end()) 29 | { 30 | d[w[i].size()] = std::vector(); 31 | } 32 | d[w[i].size()].push_back(w[i]); 33 | } 34 | 35 | printf("Number of letters in the word? \n"; 36 | int l; 37 | printf("%d\n", l); 38 | 39 | if (d.find(l) != d.end()) 40 | { 41 | // Note: On windows when using mingw, this will always return the same pattern. 42 | // https://stackoverflow.com/questions/18880654/why-do-i-get-the-same-sequence-for-every-run-with-stdrandom-device-with-mingw 43 | // Use MSVC, Clang, or GCC on Linux to get around this. 44 | std::random_device rd; 45 | std::mt19937_64 gen(rd()); 46 | 47 | std::uniform_int_distribution rng(0, d[l].size()); 48 | 49 | std::string word = d[l][rng(gen)]; 50 | 51 | std::vector v(word.size()); 52 | int e = 0; 53 | bool done = true; 54 | 55 | while (e < 10) 56 | { 57 | done = true; 58 | for (size_t i = 0; i < word.size(); ++i) 59 | { 60 | if(!v[i]) 61 | { 62 | done = false; 63 | } 64 | } 65 | if (done) 66 | { 67 | break; 68 | } 69 | 70 | printf("Guess a letter: "); 71 | char chr; 72 | scanf("%c",char); 73 | 74 | // TODO check if previously entered. 75 | bool hit = false; 76 | for (size_t i = 0; i < word.size(); ++i) 77 | { 78 | if (word[i] == chr && !v[i]) 79 | { 80 | v[i] = true; 81 | hit = true; 82 | } 83 | } 84 | 85 | if (hit) 86 | { 87 | printf("Hit! \n"); 88 | } 89 | else 90 | { 91 | printf("Missed, mistake "); 92 | printf("%d+1",e); 93 | printf(" out of 10 \n"); 94 | ++e; 95 | 96 | // drawing hangman 97 | printf("\n"); 98 | if (e>2) printf(" xxxxxxxxxxxxx \n"); 99 | else printf("\n"); 100 | 101 | if (e>3) printf(" x x \n"); 102 | else if (e > 1) printf(" x \n"); 103 | else printf("\n"); 104 | 105 | if(e>3) printf(" x x \n"); 106 | else if (e > 1) printf(" x \n"); 107 | else printf("\n"); 108 | 109 | if(e>4) printf(" xxx x \n"); 110 | else if (e > 1) printf(" x \n"); 111 | else printf("\n"); 112 | 113 | if(e>4) printf(" xxxxx x \n"); 114 | else if (e > 1) printf(" x \n"); 115 | else printf("\n"); 116 | 117 | if(e>4) printf(" xxx x \n"); 118 | else if (e > 1) printf(" x \n"); 119 | else printf("\n"); 120 | 121 | if(e>5) printf(" x x \n"); 122 | else if (e > 1) printf(" x \n"); 123 | else printf("\n"); 124 | 125 | if(e>7) printf(" x x x x \n"); 126 | else if(e>6) printf(" x x x \n"); 127 | else if(e>5) printf(" x x \n"); 128 | else if (e > 1) printf(" x \n"); 129 | else printf("\n"); 130 | 131 | if(e>7) printf(" x x x x \n"); 132 | else if(e>6) printf(" x x x \n"); 133 | else if(e>5) printf(" x x \n"); 134 | else if (e > 1) printf(" x \n"); 135 | else printf("\n"); 136 | 137 | if(e>5) printf(" x x \n"); 138 | else if (e > 1) printf(" x \n"); 139 | else printf("\n"); 140 | 141 | if(e>9) printf(" x x x \n"); 142 | else if(e>8) printf(" x x \n"); 143 | else if (e > 1) printf(" x \n"); 144 | else printf("\n"); 145 | 146 | if(e>9) printf(" x x x \n"); 147 | else if(e>8) printf(" x x \n"); 148 | else if (e > 1) printf(" x \n"); 149 | else printf("\n"); 150 | 151 | if(e>1) printf(" x \n"); 152 | else printf("\n"); 153 | 154 | if(e>1) printf(" x \n"); 155 | else printf("\n"); 156 | 157 | if(e>0) printf"xxxxxxxxxxxxxxxxxxxxxxxxxxxx \n"); 158 | else printf("\n"); 159 | printf("\n"); 160 | } 161 | 162 | printf("The word: "); 163 | for (size_t i = 0; i < word.size(); ++i) 164 | { 165 | if (v[i]) 166 | { 167 | printf(" "); 168 | printf("%c",word[i]); 169 | printf(" "); 170 | } 171 | else 172 | { 173 | printf(" _ "); 174 | } 175 | } 176 | 177 | printf("\n\n"); 178 | } 179 | 180 | // printing final result 181 | if (done) 182 | { 183 | printf("You won! \n"); 184 | } 185 | else 186 | { 187 | printf("You lost. \n"); 188 | printf("The word was: \n"); 189 | printf("%c", word); 190 | printf("\n"); 191 | } 192 | } 193 | else 194 | { 195 | printf("Sorry, no words like that.\n"); 196 | } 197 | 198 | } -------------------------------------------------------------------------------- /hangman/Go/README.md: -------------------------------------------------------------------------------- 1 | This project is written in Go 2 | 3 | In order to compile this program, you need to have Go installed (see: https://golang.org/doc/install) 4 | 5 | `git clone https://github.com/floppylab/clean-code` 6 | 7 | `cd clean-code/hangman/Go` 8 | 9 | To run this program locally on command line: `go run hangman.go` -------------------------------------------------------------------------------- /hangman/Go/hangman.go: -------------------------------------------------------------------------------- 1 | package main 2 | import ( 3 | "fmt" 4 | "math/rand" 5 | "io/ioutil" 6 | "strings" 7 | "strconv" 8 | "sort" 9 | ) 10 | 11 | func main(){ 12 | // Reading text file, store it in string format, split it line by line 13 | br, err := ioutil.ReadFile("resources/words.in") 14 | 15 | if err != nil { 16 | fmt.Print(err) 17 | } 18 | 19 | temp := string(br) 20 | line := strings.Split(temp,"\n") 21 | 22 | // Sorting words by length 23 | d := make(map[string][]string) 24 | for i := range line { 25 | length := strconv.Itoa(len(line[i])) 26 | d[length] = append(d[length], line[i]) 27 | } 28 | 29 | var keys []string 30 | for k := range d { 31 | keys = append(keys, k) 32 | } 33 | 34 | sort.Strings(keys) 35 | 36 | fmt.Print("Number of letters in the word? ") 37 | var l string 38 | fmt.Scanln(&l) 39 | 40 | _, contains := d[l] 41 | 42 | if contains { 43 | word := d[l][rand.Intn(len(d[l]))] 44 | 45 | v := make([]bool, len(word)) 46 | e := 0 47 | done := true 48 | 49 | for e < 10 { 50 | done = true 51 | for i := 0; i < len(word); i++ { 52 | if(!v[i]){ 53 | done = false 54 | } 55 | } 56 | 57 | if (done) { 58 | break 59 | } 60 | 61 | fmt.Println(word) 62 | fmt.Print("Guess a letter: ") 63 | var char string 64 | fmt.Scanln(&char) 65 | 66 | hit := false 67 | for i := 0; i < len(word); i++{ 68 | if(string(word[i]) == char && !v[i]){ 69 | v[i] = true 70 | hit = true 71 | } 72 | } 73 | 74 | if(hit) { 75 | fmt.Println("Hit!") 76 | } else { 77 | e++ 78 | fmt.Print("Missed, mistake %d out %d \n", e, 10) 79 | 80 | // Drawing hangman 81 | 82 | fmt.Print("\n") 83 | if(e>2) { 84 | fmt.Println(" xxxxxxxxxxxxx") 85 | } else { 86 | fmt.Print("\n") 87 | } 88 | 89 | if(e>3) { 90 | fmt.Println(" x x") 91 | } else if (e > 1) { 92 | fmt.Println(" x") 93 | } else {fmt.Print("\n")} 94 | 95 | if(e>3) { 96 | fmt.Println(" x x") 97 | } else if (e > 1) { 98 | fmt.Println(" x") 99 | } else { 100 | fmt.Print("\n") 101 | } 102 | 103 | if(e>4) { 104 | fmt.Println(" xxx x") 105 | } else if (e > 1) { 106 | fmt.Println(" x") 107 | } else { 108 | fmt.Print("\n") 109 | } 110 | 111 | if(e>4) { 112 | fmt.Println(" xxxxx x") 113 | } else if (e > 1) { 114 | fmt.Println(" x") 115 | } else { 116 | fmt.Print("\n") 117 | } 118 | 119 | if(e>4) { 120 | fmt.Println(" xxx x") 121 | } else if (e > 1) { 122 | fmt.Println(" x") 123 | } else { 124 | fmt.Print("\n") 125 | } 126 | 127 | if(e>5) { 128 | fmt.Println(" x x") 129 | } else if (e > 1) { 130 | fmt.Println(" x") 131 | } else { 132 | fmt.Print("\n") 133 | } 134 | 135 | if(e>7) { 136 | fmt.Println(" x x x x") 137 | } else if(e>6) { 138 | fmt.Println(" x x x") 139 | } else if(e>5) { 140 | fmt.Println(" x x") 141 | } else if (e > 1) { 142 | fmt.Println(" x") 143 | } else { 144 | fmt.Print("\n") 145 | } 146 | 147 | if(e>7) { 148 | fmt.Println(" x x x x") 149 | } else if(e>6) { 150 | fmt.Println(" x x x") 151 | } else if(e>5) { 152 | fmt.Println(" x x") 153 | } else if (e > 1) { 154 | fmt.Println(" x") 155 | } else { 156 | fmt.Print("\n") 157 | } 158 | 159 | if(e>5) { 160 | fmt.Println(" x x") 161 | } else if (e > 1) { 162 | fmt.Println(" x") 163 | } else {fmt.Print("\n")} 164 | 165 | if(e>9) { 166 | fmt.Println(" x x x") 167 | } else if(e>8) { 168 | fmt.Println(" x x") 169 | } else if (e > 1) { 170 | fmt.Println(" x") 171 | } else { 172 | fmt.Print("\n") 173 | } 174 | 175 | if(e>9) { 176 | fmt.Println(" x x x") 177 | } else if(e>8) { 178 | fmt.Println(" x x") 179 | } else if (e > 1) { 180 | fmt.Println(" x") 181 | } else { 182 | fmt.Print("\n") 183 | } 184 | 185 | if(e>1) { 186 | fmt.Println(" x") 187 | } else { 188 | fmt.Print("\n") 189 | } 190 | 191 | if(e>1) { 192 | fmt.Println(" x") 193 | } else { 194 | fmt.Print("\n") 195 | } 196 | 197 | if(e>0) { 198 | fmt.Println("xxxxxxxxxxxxxxxxxxxxxxxxxxxx") 199 | } else { 200 | fmt.Println("\n") 201 | } 202 | 203 | fmt.Print("\n") 204 | } 205 | 206 | fmt.Print("The word: ") 207 | for i := 0; i < len(word); i++ { 208 | if(v[i]) { 209 | fmt.Print(" " + string(word[i]) + " ") 210 | } else { 211 | fmt.Print(" _ ") 212 | } 213 | } 214 | 215 | fmt.Print("\n\n") 216 | } 217 | 218 | if(done){ 219 | fmt.Println("You won!") 220 | } else { 221 | fmt.Println("You lost.") 222 | fmt.Println("The word was: " + word) 223 | } 224 | } else { 225 | fmt.Println("Sorry, no words like that.") 226 | } 227 | } -------------------------------------------------------------------------------- /hangman/Go/resources/words.in: -------------------------------------------------------------------------------- 1 | abandon 2 | ability 3 | abortion 4 | abroad 5 | absence 6 | absolute 7 | absolutely 8 | absorb 9 | abstract 10 | academic 11 | accelerate 12 | accent 13 | accept 14 | acceptable 15 | acceptance 16 | access 17 | accessible 18 | accident 19 | accommodate 20 | accompany 21 | accomplish 22 | accomplishment 23 | according 24 | account 25 | accountability 26 | accounting 27 | accuracy 28 | accurate 29 | accurately 30 | accusation 31 | accuse 32 | achieve 33 | achievement 34 | acknowledge 35 | acquire 36 | acquisition 37 | across 38 | action 39 | active 40 | actively 41 | activist 42 | activity 43 | actress 44 | actual 45 | actually 46 | addition 47 | additional 48 | address 49 | adequate 50 | adjust 51 | adjustment 52 | administer 53 | administration 54 | administrative 55 | administrator 56 | admire 57 | admission 58 | adolescent 59 | adoption 60 | advance 61 | advanced 62 | advantage 63 | adventure 64 | advertising 65 | advice 66 | advise 67 | adviser 68 | advocate 69 | aesthetic 70 | affair 71 | affect 72 | afford 73 | afraid 74 | afternoon 75 | afterward 76 | against 77 | agency 78 | agenda 79 | aggression 80 | aggressive 81 | agreement 82 | agricultural 83 | agriculture 84 | aircraft 85 | airline 86 | airplane 87 | airport 88 | alcohol 89 | allegation 90 | alleged 91 | allegedly 92 | alliance 93 | almost 94 | alongside 95 | already 96 | alternative 97 | although 98 | altogether 99 | aluminum 100 | always 101 | amazing 102 | ambassador 103 | ambition 104 | ambitious 105 | amendment 106 | amount 107 | analysis 108 | analyst 109 | analyze 110 | ancestor 111 | ancient 112 | and/or 113 | animal 114 | anniversary 115 | announce 116 | announcement 117 | annual 118 | annually 119 | anonymous 120 | another 121 | answer 122 | anticipate 123 | anxiety 124 | anxious 125 | anybody 126 | anymore 127 | anyone 128 | anything 129 | anyway 130 | anywhere 131 | apartment 132 | apologize 133 | apology 134 | apparent 135 | apparently 136 | appeal 137 | appear 138 | appearance 139 | application 140 | appoint 141 | appointment 142 | appreciate 143 | appreciation 144 | approach 145 | appropriate 146 | approval 147 | approve 148 | approximately 149 | architect 150 | architecture 151 | argument 152 | around 153 | arrange 154 | arrangement 155 | arrest 156 | arrival 157 | arrive 158 | article 159 | articulate 160 | artifact 161 | artificial 162 | artist 163 | artistic 164 | asleep 165 | aspect 166 | assault 167 | assemble 168 | assembly 169 | assert 170 | assess 171 | assessment 172 | assign 173 | assignment 174 | assist 175 | assistance 176 | assistant 177 | associate 178 | associated 179 | association 180 | assume 181 | assumption 182 | assure 183 | astronomer 184 | athlete 185 | athletic 186 | atmosphere 187 | attach 188 | attack 189 | attempt 190 | attend 191 | attendance 192 | attention 193 | attitude 194 | attorney 195 | attract 196 | attraction 197 | attractive 198 | attribute 199 | auction 200 | audience 201 | author 202 | authority 203 | authorize 204 | automatic 205 | automatically 206 | automobile 207 | autonomy 208 | availability 209 | available 210 | average 211 | awareness 212 | background 213 | backyard 214 | bacteria 215 | balance 216 | balanced 217 | balloon 218 | ballot 219 | banana 220 | banker 221 | banking 222 | bankruptcy 223 | barely 224 | barrel 225 | barrier 226 | baseball 227 | basement 228 | basically 229 | basket 230 | basketball 231 | bathroom 232 | battery 233 | battle 234 | beautiful 235 | beauty 236 | because 237 | become 238 | bedroom 239 | before 240 | beginning 241 | behalf 242 | behave 243 | behavior 244 | behavioral 245 | behind 246 | belief 247 | believe 248 | belong 249 | beneath 250 | benefit 251 | beside 252 | besides 253 | better 254 | between 255 | beyond 256 | bicycle 257 | billion 258 | biography 259 | biological 260 | biology 261 | birthday 262 | bishop 263 | bitter 264 | blanket 265 | blessing 266 | bloody 267 | bombing 268 | border 269 | boring 270 | borrow 271 | bother 272 | bottle 273 | bottom 274 | bounce 275 | boundary 276 | boyfriend 277 | branch 278 | breakfast 279 | breast 280 | breath 281 | breathe 282 | breathing 283 | breeze 284 | bridge 285 | briefly 286 | bright 287 | brilliant 288 | broadcast 289 | broken 290 | broker 291 | bronze 292 | brother 293 | brutal 294 | bubble 295 | bucket 296 | budget 297 | builder 298 | building 299 | bullet 300 | burden 301 | bureau 302 | burning 303 | business 304 | businessman 305 | butter 306 | butterfly 307 | button 308 | cabinet 309 | calculate 310 | calculation 311 | calendar 312 | camera 313 | campaign 314 | campus 315 | cancel 316 | cancer 317 | candidate 318 | candle 319 | canvas 320 | capability 321 | capable 322 | capacity 323 | capital 324 | captain 325 | capture 326 | carbohydrate 327 | carbon 328 | career 329 | careful 330 | carefully 331 | carpet 332 | carrier 333 | carrot 334 | cartoon 335 | casino 336 | casual 337 | casualty 338 | catalog 339 | category 340 | cattle 341 | ceiling 342 | celebrate 343 | celebration 344 | celebrity 345 | cemetery 346 | center 347 | central 348 | century 349 | ceremony 350 | certain 351 | certainly 352 | chairman 353 | challenge 354 | chamber 355 | champion 356 | championship 357 | chance 358 | change 359 | changing 360 | channel 361 | chapter 362 | character 363 | characteristic 364 | characterize 365 | charge 366 | charity 367 | charter 368 | cheese 369 | chemical 370 | chemistry 371 | chicken 372 | childhood 373 | chocolate 374 | choice 375 | cholesterol 376 | choose 377 | chronic 378 | church 379 | cigarette 380 | circle 381 | circuit 382 | circumstance 383 | citizen 384 | citizenship 385 | civilian 386 | civilization 387 | classic 388 | classical 389 | classify 390 | classroom 391 | clearly 392 | client 393 | climate 394 | clinic 395 | clinical 396 | closed 397 | closely 398 | closer 399 | closest 400 | closet 401 | clothes 402 | clothing 403 | cluster 404 | coalition 405 | coastal 406 | cocaine 407 | coffee 408 | cognitive 409 | collaboration 410 | collapse 411 | collar 412 | colleague 413 | collect 414 | collection 415 | collective 416 | collector 417 | college 418 | colonial 419 | colony 420 | colorful 421 | column 422 | columnist 423 | combat 424 | combination 425 | combine 426 | combined 427 | comedy 428 | comfort 429 | comfortable 430 | coming 431 | command 432 | commander 433 | comment 434 | commercial 435 | commission 436 | commissioner 437 | commit 438 | commitment 439 | committee 440 | commodity 441 | common 442 | commonly 443 | communicate 444 | communication 445 | community 446 | companion 447 | company 448 | comparable 449 | compare 450 | comparison 451 | compel 452 | compelling 453 | compensation 454 | compete 455 | competition 456 | competitive 457 | competitor 458 | complain 459 | complaint 460 | complete 461 | completely 462 | complex 463 | complexity 464 | compliance 465 | complicated 466 | comply 467 | component 468 | compose 469 | composition 470 | compound 471 | comprehensive 472 | comprise 473 | compromise 474 | computer 475 | concede 476 | conceive 477 | concentrate 478 | concentration 479 | concept 480 | conception 481 | concern 482 | concerned 483 | concerning 484 | concert 485 | conclude 486 | conclusion 487 | concrete 488 | condemn 489 | condition 490 | conduct 491 | conference 492 | confess 493 | confession 494 | confidence 495 | confident 496 | confirm 497 | conflict 498 | confront 499 | confrontation 500 | confuse 501 | confusion 502 | congressional 503 | connect 504 | connection 505 | conscience 506 | conscious 507 | consciousness 508 | consecutive 509 | consensus 510 | consent 511 | consequence 512 | consequently 513 | conservation 514 | conservative 515 | consider 516 | considerable 517 | considerably 518 | consideration 519 | consist 520 | consistent 521 | consistently 522 | conspiracy 523 | constant 524 | constantly 525 | constitute 526 | constitution 527 | constitutional 528 | constraint 529 | construct 530 | construction 531 | consult 532 | consultant 533 | consume 534 | consumer 535 | consumption 536 | contact 537 | contain 538 | container 539 | contemplate 540 | contemporary 541 | contend 542 | content 543 | contest 544 | context 545 | continent 546 | continue 547 | continued 548 | continuing 549 | continuous 550 | contract 551 | contractor 552 | contrast 553 | contribute 554 | contribution 555 | contributor 556 | control 557 | controversial 558 | controversy 559 | convenience 560 | convention 561 | conventional 562 | conversation 563 | conversion 564 | convert 565 | convey 566 | convict 567 | conviction 568 | convince 569 | convinced 570 | cookie 571 | cooking 572 | cooperate 573 | cooperation 574 | cooperative 575 | coordinate 576 | coordinator 577 | corner 578 | corporate 579 | corporation 580 | correct 581 | correctly 582 | correlation 583 | correspondent 584 | corridor 585 | corruption 586 | costly 587 | costume 588 | cottage 589 | cotton 590 | council 591 | counsel 592 | counseling 593 | counselor 594 | counter 595 | counterpart 596 | country 597 | county 598 | couple 599 | courage 600 | course 601 | courtroom 602 | cousin 603 | coverage 604 | create 605 | creation 606 | creative 607 | creativity 608 | creature 609 | credibility 610 | credit 611 | criminal 612 | crisis 613 | criteria 614 | critic 615 | critical 616 | criticism 617 | criticize 618 | crowded 619 | crucial 620 | cruise 621 | crystal 622 | cultural 623 | culture 624 | curiosity 625 | curious 626 | currency 627 | current 628 | currently 629 | curriculum 630 | curtain 631 | custody 632 | custom 633 | customer 634 | damage 635 | dancer 636 | dancing 637 | danger 638 | dangerous 639 | darkness 640 | database 641 | daughter 642 | deadline 643 | deadly 644 | dealer 645 | debate 646 | debris 647 | decade 648 | decent 649 | decide 650 | decision 651 | declare 652 | decline 653 | decorate 654 | decrease 655 | dedicate 656 | deeply 657 | defeat 658 | defend 659 | defendant 660 | defender 661 | defense 662 | defensive 663 | deficit 664 | define 665 | definitely 666 | definition 667 | degree 668 | deliberately 669 | delicate 670 | delight 671 | deliver 672 | delivery 673 | demand 674 | democracy 675 | democratic 676 | demographic 677 | demonstrate 678 | demonstration 679 | denial 680 | density 681 | depart 682 | department 683 | departure 684 | depend 685 | dependent 686 | depending 687 | depict 688 | deploy 689 | deposit 690 | depressed 691 | depression 692 | deputy 693 | derive 694 | descend 695 | describe 696 | description 697 | desert 698 | deserve 699 | design 700 | designer 701 | desire 702 | desperate 703 | desperately 704 | despite 705 | dessert 706 | destination 707 | destroy 708 | destruction 709 | detail 710 | detailed 711 | detect 712 | detective 713 | determination 714 | determine 715 | devastating 716 | develop 717 | developer 718 | developing 719 | development 720 | developmental 721 | device 722 | devote 723 | diabetes 724 | diagnose 725 | diagnosis 726 | dialogue 727 | diamond 728 | dictate 729 | differ 730 | difference 731 | different 732 | differently 733 | difficult 734 | difficulty 735 | digital 736 | dignity 737 | dilemma 738 | dimension 739 | diminish 740 | dining 741 | dinner 742 | diplomat 743 | diplomatic 744 | direct 745 | direction 746 | directly 747 | director 748 | disability 749 | disabled 750 | disagree 751 | disappear 752 | disappointed 753 | disappointment 754 | disaster 755 | discipline 756 | disclose 757 | discount 758 | discourage 759 | discourse 760 | discover 761 | discovery 762 | discrimination 763 | discuss 764 | discussion 765 | disease 766 | dismiss 767 | disorder 768 | display 769 | dispute 770 | dissolve 771 | distance 772 | distant 773 | distinct 774 | distinction 775 | distinctive 776 | distinguish 777 | distract 778 | distribute 779 | distribution 780 | district 781 | disturb 782 | disturbing 783 | diverse 784 | diversity 785 | divide 786 | divine 787 | division 788 | divorce 789 | doctor 790 | doctrine 791 | document 792 | documentary 793 | domain 794 | domestic 795 | dominant 796 | dominate 797 | donate 798 | donation 799 | doorway 800 | double 801 | downtown 802 | dramatic 803 | dramatically 804 | drawer 805 | drawing 806 | drinking 807 | driver 808 | driveway 809 | driving 810 | during 811 | dynamic 812 | dynamics 813 | earnings 814 | earthquake 815 | easily 816 | eastern 817 | eating 818 | ecological 819 | economic 820 | economically 821 | economics 822 | economist 823 | economy 824 | ecosystem 825 | edition 826 | editor 827 | educate 828 | education 829 | educational 830 | educator 831 | effect 832 | effective 833 | effectively 834 | effectiveness 835 | efficiency 836 | efficient 837 | effort 838 | eighth 839 | either 840 | elaborate 841 | elderly 842 | election 843 | electric 844 | electrical 845 | electricity 846 | electronic 847 | electronics 848 | elegant 849 | element 850 | elementary 851 | elephant 852 | elevator 853 | eleven 854 | eligible 855 | eliminate 856 | elsewhere 857 | embarrassed 858 | embrace 859 | emerge 860 | emergency 861 | emerging 862 | emission 863 | emotion 864 | emotional 865 | emotionally 866 | emphasis 867 | emphasize 868 | empire 869 | employ 870 | employee 871 | employer 872 | employment 873 | enable 874 | encounter 875 | encourage 876 | encouraging 877 | endless 878 | endorse 879 | endure 880 | energy 881 | enforce 882 | enforcement 883 | engage 884 | engagement 885 | engine 886 | engineer 887 | engineering 888 | enhance 889 | enormous 890 | enough 891 | enroll 892 | ensure 893 | enterprise 894 | entertainment 895 | enthusiasm 896 | entire 897 | entirely 898 | entitle 899 | entity 900 | entrance 901 | entrepreneur 902 | envelope 903 | environment 904 | environmental 905 | envision 906 | epidemic 907 | episode 908 | equality 909 | equally 910 | equation 911 | equipment 912 | equity 913 | equivalent 914 | escape 915 | especially 916 | essence 917 | essential 918 | essentially 919 | establish 920 | establishment 921 | estate 922 | estimate 923 | estimated 924 | ethical 925 | ethics 926 | ethnic 927 | evaluate 928 | evaluation 929 | evening 930 | eventually 931 | everybody 932 | everyday 933 | everyone 934 | everything 935 | everywhere 936 | evidence 937 | evident 938 | evolution 939 | evolve 940 | exactly 941 | examination 942 | examine 943 | example 944 | exceed 945 | excellent 946 | except 947 | exception 948 | excessive 949 | exchange 950 | excited 951 | excitement 952 | exciting 953 | exclude 954 | exclusive 955 | exclusively 956 | excuse 957 | execute 958 | execution 959 | executive 960 | exercise 961 | exhaust 962 | exhibit 963 | exhibition 964 | existence 965 | existing 966 | exotic 967 | expand 968 | expansion 969 | expect 970 | expectation 971 | expected 972 | expedition 973 | expense 974 | expensive 975 | experience 976 | experienced 977 | experiment 978 | experimental 979 | expert 980 | expertise 981 | explain 982 | explanation 983 | explicit 984 | explode 985 | exploit 986 | exploration 987 | explore 988 | explosion 989 | export 990 | expose 991 | exposure 992 | express 993 | expression 994 | extend 995 | extended 996 | extension 997 | extensive 998 | extent 999 | external 1000 | extraordinary 1001 | extreme 1002 | extremely 1003 | eyebrow 1004 | fabric 1005 | facilitate 1006 | facility 1007 | factor 1008 | factory 1009 | faculty 1010 | failure 1011 | fairly 1012 | familiar 1013 | family 1014 | famous 1015 | fantastic 1016 | fantasy 1017 | farmer 1018 | fascinating 1019 | fashion 1020 | faster 1021 | father 1022 | fatigue 1023 | favorable 1024 | favorite 1025 | feather 1026 | feature 1027 | federal 1028 | feedback 1029 | feeling 1030 | fellow 1031 | female 1032 | feminist 1033 | festival 1034 | fiction 1035 | fierce 1036 | fifteen 1037 | fighter 1038 | fighting 1039 | figure 1040 | filter 1041 | finally 1042 | finance 1043 | financial 1044 | finding 1045 | finger 1046 | finish 1047 | firmly 1048 | fiscal 1049 | fisherman 1050 | fishing 1051 | fitness 1052 | flavor 1053 | flexibility 1054 | flexible 1055 | flight 1056 | flower 1057 | flying 1058 | follow 1059 | following 1060 | football 1061 | forbid 1062 | forehead 1063 | foreign 1064 | foreigner 1065 | forest 1066 | forever 1067 | forget 1068 | forgive 1069 | formal 1070 | format 1071 | formation 1072 | former 1073 | formerly 1074 | formula 1075 | fortunately 1076 | fortune 1077 | forward 1078 | foster 1079 | foundation 1080 | founder 1081 | fourth 1082 | fraction 1083 | fragile 1084 | fragment 1085 | framework 1086 | franchise 1087 | frankly 1088 | freedom 1089 | freely 1090 | freeze 1091 | frequency 1092 | frequent 1093 | frequently 1094 | freshman 1095 | friend 1096 | friendly 1097 | friendship 1098 | frontier 1099 | frozen 1100 | frustrate 1101 | frustration 1102 | fucking 1103 | function 1104 | functional 1105 | fundamental 1106 | funding 1107 | funeral 1108 | furniture 1109 | furthermore 1110 | future 1111 | galaxy 1112 | gallery 1113 | garage 1114 | garbage 1115 | garden 1116 | garlic 1117 | gasoline 1118 | gather 1119 | gathering 1120 | gender 1121 | general 1122 | generally 1123 | generate 1124 | generation 1125 | generous 1126 | genetic 1127 | genius 1128 | gentle 1129 | gentleman 1130 | gently 1131 | genuine 1132 | gesture 1133 | gifted 1134 | girlfriend 1135 | glance 1136 | glimpse 1137 | global 1138 | golden 1139 | govern 1140 | government 1141 | governor 1142 | gradually 1143 | graduate 1144 | graduation 1145 | grandchild 1146 | grandfather 1147 | grandmother 1148 | grandparent 1149 | grateful 1150 | gravity 1151 | greatest 1152 | greatly 1153 | grocery 1154 | ground 1155 | growing 1156 | growth 1157 | guarantee 1158 | guidance 1159 | guideline 1160 | guilty 1161 | guitar 1162 | habitat 1163 | halfway 1164 | hallway 1165 | handful 1166 | handle 1167 | handsome 1168 | happen 1169 | happily 1170 | happiness 1171 | harassment 1172 | hardly 1173 | hardware 1174 | harmony 1175 | harvest 1176 | hazard 1177 | headache 1178 | headline 1179 | headquarters 1180 | health 1181 | healthy 1182 | hearing 1183 | heaven 1184 | heavily 1185 | height 1186 | helicopter 1187 | helmet 1188 | helpful 1189 | heritage 1190 | herself 1191 | hesitate 1192 | hidden 1193 | highlight 1194 | highly 1195 | highway 1196 | himself 1197 | historian 1198 | historic 1199 | historical 1200 | historically 1201 | history 1202 | hockey 1203 | holiday 1204 | homeland 1205 | homeless 1206 | homework 1207 | honest 1208 | honestly 1209 | hopefully 1210 | horizon 1211 | hormone 1212 | horrible 1213 | horror 1214 | hospital 1215 | hostage 1216 | hostile 1217 | household 1218 | housing 1219 | however 1220 | humanity 1221 | hundred 1222 | hunger 1223 | hungry 1224 | hunter 1225 | hunting 1226 | hurricane 1227 | husband 1228 | hypothesis 1229 | identical 1230 | identification 1231 | identify 1232 | identity 1233 | ideological 1234 | ideology 1235 | ignore 1236 | illegal 1237 | illness 1238 | illusion 1239 | illustrate 1240 | imagination 1241 | imagine 1242 | immediate 1243 | immediately 1244 | immigrant 1245 | immigration 1246 | immune 1247 | impact 1248 | implement 1249 | implementation 1250 | implication 1251 | import 1252 | importance 1253 | important 1254 | importantly 1255 | impose 1256 | impossible 1257 | impress 1258 | impression 1259 | impressive 1260 | improve 1261 | improved 1262 | improvement 1263 | impulse 1264 | incentive 1265 | incident 1266 | include 1267 | including 1268 | income 1269 | incorporate 1270 | increase 1271 | increased 1272 | increasing 1273 | increasingly 1274 | incredible 1275 | incredibly 1276 | indeed 1277 | independence 1278 | independent 1279 | indicate 1280 | indication 1281 | indicator 1282 | indigenous 1283 | individual 1284 | industrial 1285 | industry 1286 | inevitable 1287 | inevitably 1288 | infant 1289 | infection 1290 | inflation 1291 | influence 1292 | influential 1293 | inform 1294 | informal 1295 | information 1296 | infrastructure 1297 | ingredient 1298 | inherent 1299 | inherit 1300 | initial 1301 | initially 1302 | initiate 1303 | initiative 1304 | injure 1305 | injury 1306 | inmate 1307 | innocent 1308 | innovation 1309 | innovative 1310 | inquiry 1311 | insect 1312 | insert 1313 | inside 1314 | insight 1315 | insist 1316 | inspection 1317 | inspector 1318 | inspiration 1319 | inspire 1320 | install 1321 | installation 1322 | instance 1323 | instant 1324 | instantly 1325 | instead 1326 | instinct 1327 | institution 1328 | institutional 1329 | instruct 1330 | instruction 1331 | instructional 1332 | instructor 1333 | instrument 1334 | insurance 1335 | intact 1336 | integrate 1337 | integrated 1338 | integration 1339 | integrity 1340 | intellectual 1341 | intelligence 1342 | intelligent 1343 | intend 1344 | intense 1345 | intensity 1346 | intent 1347 | intention 1348 | interact 1349 | interaction 1350 | interest 1351 | interested 1352 | interesting 1353 | interfere 1354 | interior 1355 | internal 1356 | international 1357 | interpret 1358 | interpretation 1359 | interrupt 1360 | interval 1361 | intervention 1362 | interview 1363 | intimate 1364 | introduce 1365 | introduction 1366 | invade 1367 | invasion 1368 | invent 1369 | invention 1370 | inventory 1371 | invest 1372 | investigate 1373 | investigation 1374 | investigator 1375 | investment 1376 | investor 1377 | invisible 1378 | invitation 1379 | invite 1380 | involve 1381 | involved 1382 | involvement 1383 | ironically 1384 | island 1385 | isolate 1386 | isolated 1387 | isolation 1388 | itself 1389 | jacket 1390 | jewelry 1391 | journal 1392 | journalism 1393 | journalist 1394 | journey 1395 | judgment 1396 | judicial 1397 | jungle 1398 | junior 1399 | jurisdiction 1400 | justice 1401 | justify 1402 | killer 1403 | killing 1404 | kingdom 1405 | kitchen 1406 | knowledge 1407 | laboratory 1408 | ladder 1409 | landing 1410 | landmark 1411 | landscape 1412 | language 1413 | largely 1414 | lately 1415 | latter 1416 | laughter 1417 | launch 1418 | laundry 1419 | lawmaker 1420 | lawsuit 1421 | lawyer 1422 | leader 1423 | leadership 1424 | leading 1425 | league 1426 | learning 1427 | leather 1428 | lecture 1429 | legacy 1430 | legally 1431 | legend 1432 | legislation 1433 | legislative 1434 | legislator 1435 | legislature 1436 | legitimate 1437 | length 1438 | lesson 1439 | letter 1440 | liability 1441 | liberal 1442 | liberty 1443 | library 1444 | license 1445 | lifestyle 1446 | lifetime 1447 | lighting 1448 | lightly 1449 | lightning 1450 | likelihood 1451 | likely 1452 | likewise 1453 | limitation 1454 | limited 1455 | liquid 1456 | listen 1457 | listener 1458 | literally 1459 | literary 1460 | literature 1461 | little 1462 | living 1463 | locate 1464 | location 1465 | logical 1466 | lonely 1467 | longtime 1468 | lovely 1469 | loyalty 1470 | machine 1471 | magazine 1472 | magnetic 1473 | magnitude 1474 | mainly 1475 | mainstream 1476 | maintain 1477 | maintenance 1478 | majority 1479 | makeup 1480 | manage 1481 | management 1482 | manager 1483 | managing 1484 | mandate 1485 | manipulate 1486 | manner 1487 | mansion 1488 | manual 1489 | manufacturer 1490 | manufacturing 1491 | marble 1492 | margin 1493 | marine 1494 | marker 1495 | market 1496 | marketing 1497 | marketplace 1498 | marriage 1499 | married 1500 | massive 1501 | master 1502 | material 1503 | mathematics 1504 | matter 1505 | maximum 1506 | meaning 1507 | meaningful 1508 | meantime 1509 | meanwhile 1510 | measure 1511 | measurement 1512 | mechanic 1513 | mechanical 1514 | mechanism 1515 | medical 1516 | medication 1517 | medicine 1518 | medium 1519 | meeting 1520 | member 1521 | membership 1522 | memory 1523 | mental 1524 | mentally 1525 | mention 1526 | mentor 1527 | merchant 1528 | merely 1529 | message 1530 | metaphor 1531 | method 1532 | metropolitan 1533 | middle 1534 | midnight 1535 | migration 1536 | military 1537 | million 1538 | mineral 1539 | minimal 1540 | minimize 1541 | minimum 1542 | minister 1543 | ministry 1544 | minority 1545 | minute 1546 | miracle 1547 | mirror 1548 | missile 1549 | missing 1550 | mission 1551 | missionary 1552 | mistake 1553 | mixture 1554 | mobile 1555 | moderate 1556 | modern 1557 | modest 1558 | modify 1559 | molecule 1560 | moment 1561 | momentum 1562 | monitor 1563 | monkey 1564 | monster 1565 | monthly 1566 | monument 1567 | moreover 1568 | morning 1569 | mortality 1570 | mortgage 1571 | mostly 1572 | mother 1573 | motion 1574 | motivate 1575 | motivation 1576 | motive 1577 | mountain 1578 | movement 1579 | multiple 1580 | municipal 1581 | murder 1582 | muscle 1583 | museum 1584 | mushroom 1585 | musical 1586 | musician 1587 | mutter 1588 | mutual 1589 | myself 1590 | mysterious 1591 | mystery 1592 | narrative 1593 | narrow 1594 | nation 1595 | national 1596 | nationwide 1597 | native 1598 | natural 1599 | naturally 1600 | nature 1601 | nearby 1602 | nearly 1603 | necessarily 1604 | necessary 1605 | necessity 1606 | needle 1607 | negative 1608 | negotiate 1609 | negotiation 1610 | neighbor 1611 | neighborhood 1612 | neighboring 1613 | neither 1614 | nervous 1615 | network 1616 | neutral 1617 | nevertheless 1618 | newspaper 1619 | nightmare 1620 | nobody 1621 | nomination 1622 | nominee 1623 | nonetheless 1624 | nonprofit 1625 | normal 1626 | normally 1627 | northeast 1628 | northern 1629 | northwest 1630 | notebook 1631 | nothing 1632 | notice 1633 | notion 1634 | nowhere 1635 | nuclear 1636 | number 1637 | numerous 1638 | nutrient 1639 | object 1640 | objection 1641 | objective 1642 | obligation 1643 | observation 1644 | observe 1645 | observer 1646 | obstacle 1647 | obtain 1648 | obvious 1649 | obviously 1650 | occasion 1651 | occasional 1652 | occasionally 1653 | occupation 1654 | occupy 1655 | o'clock 1656 | offender 1657 | offense 1658 | offensive 1659 | offering 1660 | office 1661 | officer 1662 | official 1663 | officially 1664 | ongoing 1665 | online 1666 | opening 1667 | openly 1668 | operate 1669 | operating 1670 | operation 1671 | operator 1672 | opinion 1673 | opponent 1674 | opportunity 1675 | oppose 1676 | opposed 1677 | opposite 1678 | opposition 1679 | optimistic 1680 | option 1681 | orange 1682 | ordinary 1683 | organic 1684 | organism 1685 | organization 1686 | organizational 1687 | organize 1688 | organized 1689 | orientation 1690 | origin 1691 | original 1692 | originally 1693 | others 1694 | otherwise 1695 | ourselves 1696 | outcome 1697 | outdoor 1698 | outfit 1699 | outlet 1700 | outline 1701 | output 1702 | outside 1703 | outsider 1704 | outstanding 1705 | overall 1706 | overcome 1707 | overlook 1708 | overnight 1709 | oversee 1710 | overwhelm 1711 | overwhelming 1712 | ownership 1713 | oxygen 1714 | package 1715 | painful 1716 | painter 1717 | painting 1718 | palace 1719 | parade 1720 | parent 1721 | parental 1722 | parish 1723 | parking 1724 | partial 1725 | partially 1726 | participant 1727 | participate 1728 | participation 1729 | particle 1730 | particular 1731 | particularly 1732 | partly 1733 | partner 1734 | partnership 1735 | passage 1736 | passenger 1737 | passing 1738 | passion 1739 | pastor 1740 | patent 1741 | patience 1742 | patient 1743 | patrol 1744 | patron 1745 | pattern 1746 | payment 1747 | peaceful 1748 | peanut 1749 | peasant 1750 | penalty 1751 | pencil 1752 | pension 1753 | people 1754 | pepper 1755 | perceive 1756 | perceived 1757 | percentage 1758 | perception 1759 | perfect 1760 | perfectly 1761 | perform 1762 | performance 1763 | performer 1764 | perhaps 1765 | period 1766 | permanent 1767 | permission 1768 | permit 1769 | persist 1770 | person 1771 | personal 1772 | personality 1773 | personally 1774 | personnel 1775 | perspective 1776 | persuade 1777 | phenomenon 1778 | philosophical 1779 | philosophy 1780 | photograph 1781 | photographer 1782 | photography 1783 | phrase 1784 | physical 1785 | physically 1786 | physician 1787 | physics 1788 | pickup 1789 | picture 1790 | pillow 1791 | pioneer 1792 | pistol 1793 | pitcher 1794 | placement 1795 | plaintiff 1796 | planet 1797 | planner 1798 | planning 1799 | plastic 1800 | platform 1801 | player 1802 | playoff 1803 | pleasant 1804 | please 1805 | pleased 1806 | pleasure 1807 | plenty 1808 | plunge 1809 | pocket 1810 | poetry 1811 | police 1812 | policeman 1813 | policy 1814 | political 1815 | politically 1816 | politician 1817 | politics 1818 | pollution 1819 | popular 1820 | popularity 1821 | population 1822 | portfolio 1823 | portion 1824 | portrait 1825 | portray 1826 | position 1827 | positive 1828 | possess 1829 | possession 1830 | possibility 1831 | possible 1832 | possibly 1833 | poster 1834 | potato 1835 | potential 1836 | potentially 1837 | poverty 1838 | powder 1839 | powerful 1840 | practical 1841 | practically 1842 | practice 1843 | practitioner 1844 | praise 1845 | prayer 1846 | preach 1847 | precious 1848 | precise 1849 | precisely 1850 | predator 1851 | predict 1852 | prediction 1853 | prefer 1854 | preference 1855 | pregnancy 1856 | pregnant 1857 | preliminary 1858 | premise 1859 | premium 1860 | preparation 1861 | prepare 1862 | prescription 1863 | presence 1864 | present 1865 | presentation 1866 | preserve 1867 | presidency 1868 | president 1869 | presidential 1870 | pressure 1871 | presumably 1872 | pretend 1873 | pretty 1874 | prevail 1875 | prevent 1876 | prevention 1877 | previous 1878 | previously 1879 | priest 1880 | primarily 1881 | primary 1882 | principal 1883 | principle 1884 | priority 1885 | prison 1886 | prisoner 1887 | privacy 1888 | private 1889 | privately 1890 | privilege 1891 | probably 1892 | problem 1893 | procedure 1894 | proceed 1895 | process 1896 | processing 1897 | processor 1898 | proclaim 1899 | produce 1900 | producer 1901 | product 1902 | production 1903 | productive 1904 | productivity 1905 | profession 1906 | professional 1907 | professor 1908 | profile 1909 | profit 1910 | profound 1911 | program 1912 | programming 1913 | progress 1914 | progressive 1915 | prohibit 1916 | project 1917 | projection 1918 | prominent 1919 | promise 1920 | promising 1921 | promote 1922 | promotion 1923 | prompt 1924 | proper 1925 | properly 1926 | property 1927 | proportion 1928 | proposal 1929 | propose 1930 | proposed 1931 | prosecution 1932 | prosecutor 1933 | prospect 1934 | protect 1935 | protection 1936 | protective 1937 | protein 1938 | protest 1939 | protocol 1940 | provide 1941 | provided 1942 | provider 1943 | province 1944 | provision 1945 | provoke 1946 | psychological 1947 | psychologist 1948 | psychology 1949 | public 1950 | publication 1951 | publicity 1952 | publicly 1953 | publish 1954 | publisher 1955 | punish 1956 | punishment 1957 | purchase 1958 | purple 1959 | purpose 1960 | pursue 1961 | pursuit 1962 | puzzle 1963 | qualify 1964 | quality 1965 | quantity 1966 | quarter 1967 | quarterback 1968 | question 1969 | questionnaire 1970 | quickly 1971 | quietly 1972 | rabbit 1973 | racial 1974 | racism 1975 | radiation 1976 | radical 1977 | railroad 1978 | random 1979 | rapidly 1980 | rarely 1981 | rather 1982 | rating 1983 | rational 1984 | reaction 1985 | reader 1986 | readily 1987 | reading 1988 | realistic 1989 | reality 1990 | realize 1991 | really 1992 | reason 1993 | reasonable 1994 | rebuild 1995 | recall 1996 | receive 1997 | receiver 1998 | recent 1999 | recently 2000 | reception 2001 | recession 2002 | recipe 2003 | recipient 2004 | recognition 2005 | recognize 2006 | recommend 2007 | recommendation 2008 | record 2009 | recording 2010 | recover 2011 | recovery 2012 | recruit 2013 | reduce 2014 | reduction 2015 | reference 2016 | reflect 2017 | reflection 2018 | reform 2019 | refrigerator 2020 | refuge 2021 | refugee 2022 | refuse 2023 | regain 2024 | regard 2025 | regarding 2026 | regardless 2027 | regime 2028 | region 2029 | regional 2030 | register 2031 | regret 2032 | regular 2033 | regularly 2034 | regulate 2035 | regulation 2036 | regulator 2037 | regulatory 2038 | rehabilitation 2039 | reinforce 2040 | reject 2041 | relate 2042 | related 2043 | relation 2044 | relationship 2045 | relative 2046 | relatively 2047 | release 2048 | relevant 2049 | reliability 2050 | reliable 2051 | relief 2052 | relieve 2053 | religion 2054 | religious 2055 | reluctant 2056 | remain 2057 | remaining 2058 | remark 2059 | remarkable 2060 | remember 2061 | remind 2062 | reminder 2063 | remote 2064 | removal 2065 | remove 2066 | render 2067 | rental 2068 | repair 2069 | repeat 2070 | repeatedly 2071 | replace 2072 | replacement 2073 | report 2074 | reportedly 2075 | reporter 2076 | reporting 2077 | represent 2078 | representation 2079 | representative 2080 | republic 2081 | reputation 2082 | request 2083 | require 2084 | required 2085 | requirement 2086 | rescue 2087 | research 2088 | researcher 2089 | resemble 2090 | reservation 2091 | reserve 2092 | residence 2093 | resident 2094 | residential 2095 | resign 2096 | resist 2097 | resistance 2098 | resolution 2099 | resolve 2100 | resort 2101 | resource 2102 | respect 2103 | respectively 2104 | respond 2105 | respondent 2106 | response 2107 | responsibility 2108 | responsible 2109 | restaurant 2110 | restore 2111 | restrict 2112 | restriction 2113 | result 2114 | resume 2115 | retail 2116 | retailer 2117 | retain 2118 | retire 2119 | retired 2120 | retirement 2121 | retreat 2122 | return 2123 | reveal 2124 | revelation 2125 | revenue 2126 | reverse 2127 | review 2128 | revolution 2129 | revolutionary 2130 | reward 2131 | rhetoric 2132 | rhythm 2133 | ribbon 2134 | ridiculous 2135 | ritual 2136 | rocket 2137 | rolling 2138 | romance 2139 | romantic 2140 | roughly 2141 | routine 2142 | routinely 2143 | rubber 2144 | ruling 2145 | runner 2146 | running 2147 | sacred 2148 | sacrifice 2149 | safely 2150 | safety 2151 | salary 2152 | salmon 2153 | sample 2154 | sanction 2155 | sandwich 2156 | satellite 2157 | satisfaction 2158 | satisfy 2159 | saving 2160 | scandal 2161 | scared 2162 | scatter 2163 | scenario 2164 | schedule 2165 | scheme 2166 | scholar 2167 | scholarship 2168 | school 2169 | science 2170 | scientific 2171 | scientist 2172 | scramble 2173 | scratch 2174 | scream 2175 | screen 2176 | screening 2177 | script 2178 | sculpture 2179 | search 2180 | season 2181 | second 2182 | secondary 2183 | secret 2184 | secretary 2185 | section 2186 | sector 2187 | secular 2188 | secure 2189 | security 2190 | seemingly 2191 | segment 2192 | seldom 2193 | select 2194 | selected 2195 | selection 2196 | seller 2197 | seminar 2198 | senator 2199 | senior 2200 | sensation 2201 | sensitive 2202 | sensitivity 2203 | sensor 2204 | sentence 2205 | sentiment 2206 | separate 2207 | separation 2208 | sequence 2209 | series 2210 | serious 2211 | seriously 2212 | servant 2213 | service 2214 | serving 2215 | session 2216 | setting 2217 | settle 2218 | settlement 2219 | seventh 2220 | several 2221 | severe 2222 | severely 2223 | sexual 2224 | sexuality 2225 | sexually 2226 | shadow 2227 | shallow 2228 | shared 2229 | shareholder 2230 | sharply 2231 | shelter 2232 | shooting 2233 | shopping 2234 | shortage 2235 | shortly 2236 | shorts 2237 | should 2238 | shoulder 2239 | shower 2240 | shrimp 2241 | shrink 2242 | shuttle 2243 | sibling 2244 | sidewalk 2245 | signal 2246 | signature 2247 | significance 2248 | significant 2249 | significantly 2250 | silence 2251 | silent 2252 | silver 2253 | similar 2254 | similarity 2255 | similarly 2256 | simple 2257 | simply 2258 | simultaneously 2259 | singer 2260 | single 2261 | sister 2262 | situation 2263 | skilled 2264 | slavery 2265 | sleeve 2266 | slight 2267 | slightly 2268 | slowly 2269 | smooth 2270 | soccer 2271 | social 2272 | socially 2273 | society 2274 | sodium 2275 | soften 2276 | softly 2277 | software 2278 | soldier 2279 | solely 2280 | solution 2281 | somebody 2282 | someday 2283 | somehow 2284 | someone 2285 | something 2286 | sometime 2287 | sometimes 2288 | somewhat 2289 | somewhere 2290 | sophisticated 2291 | source 2292 | southeast 2293 | southern 2294 | southwest 2295 | sovereignty 2296 | speaker 2297 | special 2298 | specialist 2299 | specialize 2300 | specialty 2301 | species 2302 | specific 2303 | specifically 2304 | specify 2305 | spectacular 2306 | spectrum 2307 | speculate 2308 | speculation 2309 | speech 2310 | spending 2311 | sphere 2312 | spirit 2313 | spiritual 2314 | spokesman 2315 | sponsor 2316 | spouse 2317 | spread 2318 | spring 2319 | sprinkle 2320 | square 2321 | squeeze 2322 | stability 2323 | stable 2324 | stadium 2325 | stance 2326 | standard 2327 | standing 2328 | starter 2329 | starting 2330 | statement 2331 | station 2332 | statistical 2333 | statistics 2334 | statue 2335 | status 2336 | statute 2337 | steadily 2338 | steady 2339 | stereotype 2340 | stimulate 2341 | stimulus 2342 | stomach 2343 | storage 2344 | straight 2345 | straighten 2346 | strain 2347 | strange 2348 | stranger 2349 | strategic 2350 | strategy 2351 | streak 2352 | stream 2353 | street 2354 | strength 2355 | strengthen 2356 | stress 2357 | stretch 2358 | strict 2359 | strictly 2360 | strike 2361 | striking 2362 | string 2363 | stroke 2364 | strong 2365 | strongly 2366 | structural 2367 | structure 2368 | struggle 2369 | student 2370 | studio 2371 | stumble 2372 | stupid 2373 | subject 2374 | submit 2375 | subsequent 2376 | subsidy 2377 | substance 2378 | substantial 2379 | substantially 2380 | subtle 2381 | suburb 2382 | suburban 2383 | succeed 2384 | success 2385 | successful 2386 | successfully 2387 | sudden 2388 | suddenly 2389 | suffer 2390 | suffering 2391 | sufficient 2392 | suggest 2393 | suggestion 2394 | suicide 2395 | suitable 2396 | summary 2397 | summer 2398 | summit 2399 | sunlight 2400 | superior 2401 | supermarket 2402 | supervisor 2403 | supplier 2404 | supply 2405 | support 2406 | supporter 2407 | supportive 2408 | suppose 2409 | supposed 2410 | supposedly 2411 | surely 2412 | surface 2413 | surgeon 2414 | surgery 2415 | surprise 2416 | surprised 2417 | surprising 2418 | surprisingly 2419 | surround 2420 | surrounding 2421 | surveillance 2422 | survey 2423 | survival 2424 | survive 2425 | survivor 2426 | suspect 2427 | suspend 2428 | suspicion 2429 | suspicious 2430 | sustain 2431 | sustainable 2432 | swallow 2433 | sweater 2434 | swimming 2435 | switch 2436 | symbol 2437 | symbolic 2438 | sympathy 2439 | symptom 2440 | syndrome 2441 | system 2442 | tablespoon 2443 | tackle 2444 | tactic 2445 | talent 2446 | talented 2447 | target 2448 | taxpayer 2449 | teacher 2450 | teaching 2451 | teammate 2452 | teaspoon 2453 | technical 2454 | technician 2455 | technique 2456 | technological 2457 | technology 2458 | teenage 2459 | teenager 2460 | telephone 2461 | telescope 2462 | television 2463 | temperature 2464 | temple 2465 | temporary 2466 | tendency 2467 | tender 2468 | tennis 2469 | tension 2470 | terrain 2471 | terrible 2472 | terribly 2473 | terrific 2474 | territory 2475 | terror 2476 | terrorism 2477 | terrorist 2478 | testify 2479 | testimony 2480 | testing 2481 | textbook 2482 | texture 2483 | thanks 2484 | theater 2485 | themselves 2486 | theological 2487 | theology 2488 | theoretical 2489 | theory 2490 | therapist 2491 | therapy 2492 | thereby 2493 | therefore 2494 | thinking 2495 | thirty 2496 | thoroughly 2497 | though 2498 | thought 2499 | thousand 2500 | thread 2501 | threat 2502 | threaten 2503 | threshold 2504 | thrive 2505 | throat 2506 | through 2507 | throughout 2508 | ticket 2509 | tighten 2510 | tightly 2511 | timber 2512 | timing 2513 | tissue 2514 | tobacco 2515 | together 2516 | toilet 2517 | tolerance 2518 | tolerate 2519 | tomato 2520 | tomorrow 2521 | tongue 2522 | tonight 2523 | totally 2524 | touchdown 2525 | tourism 2526 | tourist 2527 | tournament 2528 | toward 2529 | towards 2530 | trading 2531 | tradition 2532 | traditional 2533 | traditionally 2534 | traffic 2535 | tragedy 2536 | tragic 2537 | trailer 2538 | trainer 2539 | training 2540 | transaction 2541 | transfer 2542 | transform 2543 | transformation 2544 | transit 2545 | transition 2546 | translate 2547 | translation 2548 | transmission 2549 | transmit 2550 | transport 2551 | transportation 2552 | trauma 2553 | travel 2554 | traveler 2555 | treasure 2556 | treatment 2557 | treaty 2558 | tremendous 2559 | tribal 2560 | trigger 2561 | triumph 2562 | tropical 2563 | trouble 2564 | troubled 2565 | tunnel 2566 | turkey 2567 | twelve 2568 | twentieth 2569 | twenty 2570 | typical 2571 | typically 2572 | ultimate 2573 | ultimately 2574 | unable 2575 | uncertain 2576 | uncertainty 2577 | uncomfortable 2578 | uncover 2579 | undergo 2580 | undergraduate 2581 | underlying 2582 | undermine 2583 | understand 2584 | understanding 2585 | undertake 2586 | unemployment 2587 | unexpected 2588 | unfair 2589 | unfold 2590 | unfortunately 2591 | unhappy 2592 | uniform 2593 | unique 2594 | universal 2595 | universe 2596 | university 2597 | unknown 2598 | unless 2599 | unlike 2600 | unlikely 2601 | unprecedented 2602 | unusual 2603 | update 2604 | upstairs 2605 | useful 2606 | usually 2607 | utility 2608 | utilize 2609 | vacation 2610 | vaccine 2611 | vacuum 2612 | validity 2613 | valley 2614 | valuable 2615 | vanish 2616 | variable 2617 | variation 2618 | variety 2619 | various 2620 | vegetable 2621 | vehicle 2622 | vendor 2623 | venture 2624 | verbal 2625 | verdict 2626 | version 2627 | versus 2628 | vertical 2629 | vessel 2630 | veteran 2631 | victim 2632 | victory 2633 | viewer 2634 | village 2635 | violate 2636 | violation 2637 | violence 2638 | violent 2639 | virtual 2640 | virtually 2641 | virtue 2642 | visible 2643 | vision 2644 | visitor 2645 | visual 2646 | vitamin 2647 | volume 2648 | voluntary 2649 | volunteer 2650 | voting 2651 | vulnerable 2652 | walking 2653 | wander 2654 | warehouse 2655 | warmth 2656 | warning 2657 | warrior 2658 | weaken 2659 | weakness 2660 | wealth 2661 | wealthy 2662 | weapon 2663 | weather 2664 | wedding 2665 | weekend 2666 | weekly 2667 | weight 2668 | welcome 2669 | welfare 2670 | western 2671 | whatever 2672 | wheelchair 2673 | whenever 2674 | whereas 2675 | wherever 2676 | whether 2677 | whisper 2678 | whoever 2679 | widely 2680 | widespread 2681 | wilderness 2682 | wildlife 2683 | willing 2684 | willingness 2685 | window 2686 | winner 2687 | winter 2688 | wisdom 2689 | withdraw 2690 | withdrawal 2691 | within 2692 | without 2693 | witness 2694 | wonder 2695 | wonderful 2696 | wooden 2697 | worker 2698 | working 2699 | workout 2700 | workplace 2701 | workshop 2702 | worldwide 2703 | worried 2704 | writer 2705 | writing 2706 | written 2707 | yellow 2708 | yesterday 2709 | youngster 2710 | yourself -------------------------------------------------------------------------------- /hangman/Groovy/pom.xml: -------------------------------------------------------------------------------- 1 | 4 | 4.0.0 5 | com.floppylab.refactor 6 | hangman 7 | 1.1.0 8 | hangman 9 | a simple game you can improve your refactoring skills with 10 | 11 | 12 | 1.8 13 | 1.8 14 | 3.1.0 15 | 3.8.0 16 | 3.1.0 17 | 18 | 19 | 20 | 21 | junit 22 | junit 23 | 4.8.2 24 | 25 | 26 | org.codehaus.groovy 27 | groovy-all 28 | 2.5.2 29 | pom 30 | 31 | 32 | 33 | 34 | 35 | 36 | org.apache.maven.plugins 37 | maven-resources-plugin 38 | ${maven.resources.plugin.version} 39 | 40 | UTF-8 41 | 42 | 43 | 44 | org.apache.maven.plugins 45 | maven-compiler-plugin 46 | ${maven.compiler.plugin.version} 47 | 48 | 1.8 49 | 1.8 50 | UTF-8 51 | 52 | 53 | 54 | org.apache.maven.plugins 55 | maven-jar-plugin 56 | ${maven.jar.plugin.version} 57 | 58 | 59 | 60 | com.floppylab.refactor.Hangman 61 | 62 | 63 | 64 | 65 | 66 | maven-antrun-plugin 67 | 68 | 69 | compile 70 | compile 71 | 72 | 73 | 74 | 76 | 77 | 78 | 79 | 81 | 82 | 83 | 84 | 85 | 86 | run 87 | 88 | 89 | 90 | test-compile 91 | test-compile 92 | 93 | 94 | 95 | 97 | 98 | 99 | 100 | 102 | 103 | 104 | 105 | 106 | 107 | run 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | -------------------------------------------------------------------------------- /hangman/Groovy/src/main/groovy/com/floppylab/refactor/Hangman.groovy: -------------------------------------------------------------------------------- 1 | package com.floppylab.refactor 2 | 3 | public class Hangman { 4 | 5 | public static void main(final String... args) { 6 | 7 | ArrayList w = new ArrayList() 8 | HashMap> d = new HashMap<>() 9 | BufferedReader br = null; 10 | final Scanner scanner = new Scanner(System.in) 11 | String line; 12 | 13 | try { 14 | br = new BufferedReader(new InputStreamReader(Hangman.class.getResourceAsStream(("/words.in")))); 15 | 16 | // reading text file line by line 17 | while ((line = br.readLine()) != null){ 18 | w.add(line.trim()) 19 | } 20 | 21 | // sorting words by length 22 | for(int i= 0; i < w.size(); i++) { 23 | if(!d.containsKey(w.get(i).length())) { 24 | d.put(w.get(i).length(), new ArrayList<>()) 25 | } 26 | d.get(w.get(i).length()).add(w.get(i)) 27 | } 28 | 29 | print("Number of letters in the word? ") 30 | int l = scanner.nextInt() 31 | 32 | if(d.containsKey(l)) 33 | { 34 | // choose a random word with the given length 35 | String word = d.get(l).get(new Random().nextInt(d.get(l).size())); 36 | boolean[] v = new boolean[word.length()] 37 | int e = 0; 38 | boolean done = true; 39 | 40 | while (e < 10) { 41 | 42 | done = true; 43 | for (int i = 0; i < word.length(); ++i) { 44 | if (!v[i]) { 45 | done = false 46 | } 47 | } 48 | if (done) { 49 | break; 50 | } 51 | 52 | print("Guess a letter: ") 53 | char chr = scanner.next().charAt(0) 54 | 55 | // TODO check if previously entered 56 | boolean hit = false; 57 | for (int i = 0; i < word.length(); ++i) { 58 | if (word.charAt(i) == chr && !v[i]) { 59 | v[i] = true 60 | hit = true 61 | } 62 | } 63 | if (hit) { 64 | print("Hit!\n"); 65 | } else { 66 | 67 | printf( 68 | "Missed, mistake #%d out of %d\n", 69 | e + 1, 10 70 | ) 71 | ++e; 72 | 73 | // drawing hangman 74 | print("\n") 75 | if(e>2) println(" xxxxxxxxxxxxx") 76 | else print("\n") 77 | 78 | if(e>3) println(" x x"); 79 | else if (e > 1) println(" x"); 80 | else print("\n"); 81 | 82 | if(e>3) println(" x x") 83 | else if (e > 1) println(" x") 84 | else print("\n") 85 | 86 | if(e>4) println(" xxx x") 87 | else if (e > 1) println(" x") 88 | else print("\n") 89 | 90 | if(e>4) println(" xxxxx x") 91 | else if (e > 1) println(" x") 92 | else print("\n") 93 | 94 | if(e>4) println(" xxx x") 95 | else if (e > 1) println(" x") 96 | else print("\n") 97 | 98 | if(e>5) println(" x x") 99 | else if (e > 1) println(" x") 100 | else print("\n") 101 | 102 | if(e>7) println(" x x x x") 103 | else if(e>6) println(" x x x") 104 | else if(e>5) println(" x x") 105 | else if (e > 1) println(" x") 106 | else print("\n") 107 | 108 | if(e>7) println(" x x x x") 109 | else if(e>6) println(" x x x") 110 | else if(e>5) println(" x x") 111 | else if (e > 1) println(" x"); 112 | else print("\n") 113 | 114 | if(e>5) println(" x x") 115 | else if (e > 1) println(" x") 116 | else print("\n") 117 | 118 | if(e>9) println(" x x x") 119 | else if(e>8) println(" x x") 120 | else if (e > 1) println(" x") 121 | else print("\n") 122 | 123 | if(e>9) println(" x x x") 124 | else if(e>8) println(" x x") 125 | else if (e > 1) println(" x") 126 | else print("\n") 127 | 128 | if(e>1) println(" x") 129 | else print("\n") 130 | 131 | if(e>1) println(" x") 132 | else print("\n") 133 | 134 | if(e>0) println("xxxxxxxxxxxxxxxxxxxxxxxxxxxx") 135 | else println("\n") 136 | print("\n") 137 | 138 | } 139 | System.out.print("The word: ") 140 | for (int i = 0; i < word.length(); ++i) { 141 | print("The word: ") 142 | if (v[i]) { 143 | System.out.print(" " + word.charAt(i)+ " ") 144 | } else { 145 | System.out.print(" _ ") 146 | } 147 | } 148 | System.out.append("\n\n") 149 | } 150 | 151 | // printing final result 152 | if (done) { 153 | print("You won!\n") 154 | } else { 155 | print("You lost.\n") 156 | println("The word was: " + word) 157 | } 158 | } 159 | else 160 | { 161 | print("Sorry, no words like that.\n") 162 | } 163 | 164 | } catch (IOException e) { 165 | // TODO nice exception catching 166 | e.printStackTrace(); 167 | } 168 | scanner.close(); 169 | } 170 | } 171 | -------------------------------------------------------------------------------- /hangman/Java/README.md: -------------------------------------------------------------------------------- 1 | # JAVA Hangman 2 | 3 | ## This is the JAVA version of the Hangman Program 4 | 5 | To run this code, it is recommended to use an IDE . I work on eclipse, you're free to use anything that suits you. 6 | 7 | #### So this little application is made using maven for building and dependencies. 8 | #### Maven 9 | Maven - Build Tool ( used for taking all the classes containing your code bundling it together and making it a jar which you can then run ) 10 | for more info on maven : https://maven.apache.org/guides/getting-started/ 11 | 12 | So, for running this on an IDE import the project into workspace as maven project and then run the class 13 | ### com.floppylab.refactor.Hangman.java as JAVA application and that should get you the game up and running in your IDE's console 14 | 15 | Since we're also using Maven, you can also just open the Hangman folder in cmd and run 16 | ### mvn package 17 | 18 | The above will cause maven to build a jar and place it in a folder target within the Hangman folder 19 | After that you can run the jar from command line by doing 20 | ### java -jar hangman.jar 21 | 22 | And thats it, its up and running. 23 | -------------------------------------------------------------------------------- /hangman/Java/pom.xml: -------------------------------------------------------------------------------- 1 | 4 | 4.0.0 5 | com.floppylab.refactor 6 | hangman 7 | 1.0.0 8 | hangman 9 | a simple game you can improve your refactoring skills with 10 | 11 | 12 | 1.8 13 | 1.8 14 | 3.1.0 15 | 3.8.0 16 | 3.1.0 17 | 18 | 19 | 20 | 21 | junit 22 | junit 23 | 4.8.2 24 | 25 | 26 | 27 | 28 | 29 | 30 | org.apache.maven.plugins 31 | maven-resources-plugin 32 | ${maven.resources.plugin.version} 33 | 34 | UTF-8 35 | 36 | 37 | 38 | org.apache.maven.plugins 39 | maven-compiler-plugin 40 | ${maven.compiler.plugin.version} 41 | 42 | 1.8 43 | 1.8 44 | UTF-8 45 | 46 | 47 | 48 | org.apache.maven.plugins 49 | maven-jar-plugin 50 | ${maven.jar.plugin.version} 51 | 52 | 53 | 54 | com.floppylab.refactor.Hangman 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | -------------------------------------------------------------------------------- /hangman/Java/src/main/java/com/floppylab/refactor/Hangman.java: -------------------------------------------------------------------------------- 1 | package com.floppylab.refactor; 2 | 3 | import java.io.BufferedReader; 4 | import java.io.IOException; 5 | import java.io.InputStreamReader; 6 | import java.util.ArrayList; 7 | import java.util.HashMap; 8 | import java.util.Random; 9 | import java.util.Scanner; 10 | 11 | public class Hangman { 12 | 13 | public static void main(final String... args) { 14 | 15 | ArrayList w = new ArrayList(); 16 | HashMap> d = new HashMap<>(); 17 | BufferedReader br = null; 18 | final Scanner scanner = new Scanner(System.in); 19 | String line; 20 | 21 | try { 22 | br = new BufferedReader(new InputStreamReader(Hangman.class.getResourceAsStream(("/words.in")))); 23 | 24 | // reading text file line by line 25 | while ((line = br.readLine()) != null){ 26 | w.add(line.trim()); 27 | } 28 | 29 | // sorting words by length 30 | for(int i= 0; i < w.size(); i++) { 31 | if(!d.containsKey(w.get(i).length())) { 32 | d.put(w.get(i).length(), new ArrayList<>()); 33 | } 34 | d.get(w.get(i).length()).add(w.get(i)); 35 | } 36 | 37 | System.out.print("Number of letters in the word? "); 38 | int l = scanner.nextInt(); 39 | 40 | if(d.containsKey(l)) 41 | { 42 | // choose a random word with the given length 43 | String word = d.get(l).get(new Random().nextInt(d.get(l).size())); 44 | boolean[] v = new boolean[word.length()]; 45 | int e = 0; 46 | boolean done = true; 47 | 48 | while (e < 10) { 49 | 50 | done = true; 51 | for (int i = 0; i < word.length(); ++i) { 52 | if (!v[i]) { 53 | done = false; 54 | } 55 | } 56 | if (done) { 57 | break; 58 | } 59 | 60 | System.out.print("Guess a letter: "); 61 | char chr = scanner.next().charAt(0); 62 | 63 | // TODO check if previously entered 64 | boolean hit = false; 65 | for (int i = 0; i < word.length(); ++i) { 66 | if (word.charAt(i) == chr && !v[i]) { 67 | v[i] = true; 68 | hit = true; 69 | } 70 | } 71 | if (hit) { 72 | System.out.print("Hit!\n"); 73 | } else { 74 | 75 | System.out.printf( 76 | "Missed, mistake #%d out of %d\n", 77 | e + 1, 10 78 | ); 79 | ++e; 80 | 81 | // drawing hangman 82 | System.out.print("\n"); 83 | if(e>2) System.out.println(" xxxxxxxxxxxxx"); 84 | else System.out.print("\n"); 85 | 86 | if(e>3) System.out.println(" x x"); 87 | else if (e > 1) System.out.println(" x"); 88 | else System.out.print("\n"); 89 | 90 | if(e>3) System.out.println(" x x"); 91 | else if (e > 1) System.out.println(" x"); 92 | else System.out.print("\n"); 93 | 94 | if(e>4) System.out.println(" xxx x"); 95 | else if (e > 1) System.out.println(" x"); 96 | else System.out.print("\n"); 97 | 98 | if(e>4) System.out.println(" xxxxx x"); 99 | else if (e > 1) System.out.println(" x"); 100 | else System.out.print("\n"); 101 | 102 | if(e>4) System.out.println(" xxx x"); 103 | else if (e > 1) System.out.println(" x"); 104 | else System.out.print("\n"); 105 | 106 | if(e>5) System.out.println(" x x"); 107 | else if (e > 1) System.out.println(" x"); 108 | else System.out.print("\n"); 109 | 110 | if(e>7) System.out.println(" x x x x"); 111 | else if(e>6) System.out.println(" x x x"); 112 | else if(e>5) System.out.println(" x x"); 113 | else if (e > 1) System.out.println(" x"); 114 | else System.out.print("\n"); 115 | 116 | if(e>7) System.out.println(" x x x x"); 117 | else if(e>6) System.out.println(" x x x"); 118 | else if(e>5) System.out.println(" x x"); 119 | else if (e > 1) System.out.println(" x"); 120 | else System.out.print("\n"); 121 | 122 | if(e>5) System.out.println(" x x"); 123 | else if (e > 1) System.out.println(" x"); 124 | else System.out.print("\n"); 125 | 126 | if(e>9) System.out.println(" x x x"); 127 | else if(e>8) System.out.println(" x x"); 128 | else if (e > 1) System.out.println(" x"); 129 | else System.out.print("\n"); 130 | 131 | if(e>9) System.out.println(" x x x"); 132 | else if(e>8) System.out.println(" x x"); 133 | else if (e > 1) System.out.println(" x"); 134 | else System.out.print("\n"); 135 | 136 | if(e>1) System.out.println(" x"); 137 | else System.out.print("\n"); 138 | 139 | if(e>1) System.out.println(" x"); 140 | else System.out.print("\n"); 141 | 142 | if(e>0) System.out.println("xxxxxxxxxxxxxxxxxxxxxxxxxxxx"); 143 | else System.out.println("\n"); 144 | System.out.print("\n"); 145 | 146 | } 147 | System.out.print("The word: "); 148 | for (int i = 0; i < word.length(); ++i) { 149 | if (v[i]) { 150 | System.out.print(" " + word.charAt(i)+ " "); 151 | } else { 152 | System.out.print(" _ "); 153 | } 154 | } 155 | System.out.append("\n\n"); 156 | } 157 | 158 | // printing final result 159 | if (done) { 160 | System.out.print("You won!\n"); 161 | } else { 162 | System.out.print("You lost.\n"); 163 | System.out.println("The word was: " + word); 164 | } 165 | } 166 | else 167 | { 168 | System.out.print("Sorry, no words like that.\n"); 169 | } 170 | 171 | } catch (IOException e) { 172 | // TODO nice exception catching 173 | e.printStackTrace(); 174 | } 175 | scanner.close(); 176 | } 177 | } 178 | -------------------------------------------------------------------------------- /hangman/JavaScript/.gitignore: -------------------------------------------------------------------------------- 1 | /node_modules -------------------------------------------------------------------------------- /hangman/JavaScript/.nvmrc: -------------------------------------------------------------------------------- 1 | v10.9.0 2 | -------------------------------------------------------------------------------- /hangman/JavaScript/hangman.js: -------------------------------------------------------------------------------- 1 | const fsPromises = require("fs").promises; 2 | const readlineSync = require("readline-sync"); 3 | 4 | async function main() { 5 | let words = await fsPromises 6 | .stat("resources/words.in") 7 | .then(() => { 8 | console.log("File exists!"); 9 | return fsPromises.readFile("resources/words.in"); 10 | }) 11 | .then(content => { 12 | return content.toString().split("\n"); 13 | }) 14 | .catch(e => { 15 | console.log(e); 16 | }); 17 | 18 | let wordsMap = await (async function(words) { 19 | let mapReturns = new Map(); 20 | 21 | words.forEach(word => { 22 | const wordSize = word.length; 23 | if (!mapReturns.has(wordSize)) { 24 | mapReturns.set(wordSize, []); 25 | } 26 | 27 | let currentVal = mapReturns.get(wordSize); 28 | currentVal.push(word); 29 | mapReturns.set(wordSize, currentVal); 30 | }); 31 | 32 | return mapReturns; 33 | })(words); 34 | 35 | let numLetters = parseInt( 36 | readlineSync.question("Number of letters in the word? ") 37 | ); 38 | 39 | if (wordsMap.has(numLetters)) { 40 | let word = wordsMap.get(numLetters)[ 41 | parseInt(Math.random() * wordsMap.get(numLetters).length) 42 | ]; 43 | 44 | let v = new Array(word.length).fill(false); 45 | let e = 0; 46 | let done = true; 47 | 48 | while (e < 10) { 49 | done = await (async function() { 50 | let d = true; 51 | for (var i = 0; i < word.length; ++i) { 52 | if (!v[i]) { 53 | d = false; 54 | } 55 | } 56 | 57 | return d; 58 | })(); 59 | 60 | if (done) { 61 | break; 62 | } 63 | 64 | let chr = readlineSync.question("Guess a letter: "); 65 | 66 | let hit = await (async function() { 67 | let hit = false; 68 | 69 | for (var i = 0; i < word.length; ++i) { 70 | if (word[i] == chr && !v[i]) { 71 | v[i] = true; 72 | hit = true; 73 | } 74 | } 75 | 76 | return hit; 77 | })(); 78 | 79 | if (hit) { 80 | console.log("Hit!"); 81 | } else { 82 | console.log(`Missed, mistake ${e + 1} out of 10`); 83 | ++e; 84 | 85 | console.log(); 86 | if (e > 2) console.log(" xxxxxxxxxxxxx"); 87 | else console.log(); 88 | 89 | if (e > 3) console.log(" x x"); 90 | else if (e > 1) console.log(" x"); 91 | else console.log(); 92 | 93 | if (e > 3) console.log(" x x"); 94 | else if (e > 1) console.log(" x"); 95 | else console.log(); 96 | 97 | if (e > 4) console.log(" xxx x"); 98 | else if (e > 1) console.log(" x"); 99 | else console.log(); 100 | 101 | if (e > 4) console.log(" xxxxx x"); 102 | else if (e > 1) console.log(" x"); 103 | else console.log(); 104 | 105 | if (e > 4) console.log(" xxx x"); 106 | else if (e > 1) console.log(" x"); 107 | else console.log(); 108 | 109 | if (e > 5) console.log(" x x"); 110 | else if (e > 1) console.log(" x"); 111 | else console.log(); 112 | 113 | if (e > 7) console.log(" x x x x"); 114 | else if (e > 6) console.log(" x x x"); 115 | else if (e > 5) console.log(" x x"); 116 | else if (e > 1) console.log(" x"); 117 | else console.log(); 118 | 119 | if (e > 7) console.log(" x x x x"); 120 | else if (e > 6) console.log(" x x x"); 121 | else if (e > 5) console.log(" x x"); 122 | else if (e > 1) console.log(" x"); 123 | else console.log(); 124 | 125 | if (e > 5) console.log(" x x"); 126 | else if (e > 1) console.log(" x"); 127 | else console.log(); 128 | 129 | if (e > 9) console.log(" x x x"); 130 | else if (e > 8) console.log(" x x"); 131 | else if (e > 1) console.log(" x"); 132 | else console.log(); 133 | 134 | if (e > 9) console.log(" x x x"); 135 | else if (e > 8) console.log(" x x"); 136 | else if (e > 1) console.log(" x"); 137 | else console.log(); 138 | 139 | if (e > 1) console.log(" x"); 140 | else console.log(); 141 | 142 | if (e > 1) console.log(" x"); 143 | else console.log(); 144 | 145 | if (e > 0) console.log("xxxxxxxxxxxxxxxxxxxxxxxxxxxx"); 146 | else console.log(); 147 | console.log(); 148 | } 149 | await (async function() { 150 | process.stdout.write("The word: "); 151 | 152 | for (var i = 0; i < word.length; ++i) { 153 | if (v[i]) { 154 | process.stdout.write(" " + word[i] + " "); 155 | } else { 156 | process.stdout.write(" _ "); 157 | } 158 | } 159 | })(); 160 | 161 | console.log(); 162 | } 163 | 164 | // printing final result 165 | if (done) { 166 | console.log("You won!"); 167 | } else { 168 | console.log("You lost."); 169 | console.log("The word was: " + word); 170 | } 171 | } else { 172 | console.log("Sorry, no words like that."); 173 | } 174 | } 175 | 176 | main(); 177 | -------------------------------------------------------------------------------- /hangman/JavaScript/package-lock.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "JavaScript", 3 | "version": "1.0.0", 4 | "lockfileVersion": 1, 5 | "requires": true, 6 | "dependencies": { 7 | "ansi-styles": { 8 | "version": "3.2.1", 9 | "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz", 10 | "integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==", 11 | "dev": true, 12 | "requires": { 13 | "color-convert": "^1.9.0" 14 | } 15 | }, 16 | "chalk": { 17 | "version": "2.4.1", 18 | "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.1.tgz", 19 | "integrity": "sha512-ObN6h1v2fTJSmUXoS3nMQ92LbDK9be4TV+6G+omQlGJFdcUX5heKi1LZ1YnRMIgwTLEj3E24bT6tYni50rlCfQ==", 20 | "dev": true, 21 | "requires": { 22 | "ansi-styles": "^3.2.1", 23 | "escape-string-regexp": "^1.0.5", 24 | "supports-color": "^5.3.0" 25 | } 26 | }, 27 | "check-node-version": { 28 | "version": "3.2.0", 29 | "resolved": "https://registry.npmjs.org/check-node-version/-/check-node-version-3.2.0.tgz", 30 | "integrity": "sha512-mJu4dADRf+NUeOyGgFTXaLtjyyffD3Eej2RA9IEk1CdHmoVurErLD++e/Ps6uKfsB273ky+0Z9NlOiuplxuNdw==", 31 | "dev": true, 32 | "requires": { 33 | "chalk": "^2.3.0", 34 | "map-values": "^1.0.1", 35 | "minimist": "^1.2.0", 36 | "object-filter": "^1.0.2", 37 | "object.assign": "^4.0.4", 38 | "run-parallel": "^1.1.4", 39 | "semver": "^5.0.3" 40 | } 41 | }, 42 | "color-convert": { 43 | "version": "1.9.3", 44 | "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-1.9.3.tgz", 45 | "integrity": "sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg==", 46 | "dev": true, 47 | "requires": { 48 | "color-name": "1.1.3" 49 | } 50 | }, 51 | "color-name": { 52 | "version": "1.1.3", 53 | "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.3.tgz", 54 | "integrity": "sha1-p9BVi9icQveV3UIyj3QIMcpTvCU=", 55 | "dev": true 56 | }, 57 | "define-properties": { 58 | "version": "1.1.3", 59 | "resolved": "https://registry.npmjs.org/define-properties/-/define-properties-1.1.3.tgz", 60 | "integrity": "sha512-3MqfYKj2lLzdMSf8ZIZE/V+Zuy+BgD6f164e8K2w7dgnpKArBDerGYpM46IYYcjnkdPNMjPk9A6VFB8+3SKlXQ==", 61 | "dev": true, 62 | "requires": { 63 | "object-keys": "^1.0.12" 64 | } 65 | }, 66 | "escape-string-regexp": { 67 | "version": "1.0.5", 68 | "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz", 69 | "integrity": "sha1-G2HAViGQqN/2rjuyzwIAyhMLhtQ=", 70 | "dev": true 71 | }, 72 | "function-bind": { 73 | "version": "1.1.1", 74 | "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.1.tgz", 75 | "integrity": "sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A==", 76 | "dev": true 77 | }, 78 | "has-flag": { 79 | "version": "3.0.0", 80 | "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz", 81 | "integrity": "sha1-tdRU3CGZriJWmfNGfloH87lVuv0=", 82 | "dev": true 83 | }, 84 | "has-symbols": { 85 | "version": "1.0.0", 86 | "resolved": "https://registry.npmjs.org/has-symbols/-/has-symbols-1.0.0.tgz", 87 | "integrity": "sha1-uhqPGvKg/DllD1yFA2dwQSIGO0Q=", 88 | "dev": true 89 | }, 90 | "map-values": { 91 | "version": "1.0.1", 92 | "resolved": "https://registry.npmjs.org/map-values/-/map-values-1.0.1.tgz", 93 | "integrity": "sha1-douOecAJvytk/ugG4ip7HEGQyZA=", 94 | "dev": true 95 | }, 96 | "minimist": { 97 | "version": "1.2.0", 98 | "resolved": "http://registry.npmjs.org/minimist/-/minimist-1.2.0.tgz", 99 | "integrity": "sha1-o1AIsg9BOD7sH7kU9M1d95omQoQ=", 100 | "dev": true 101 | }, 102 | "object-filter": { 103 | "version": "1.0.2", 104 | "resolved": "https://registry.npmjs.org/object-filter/-/object-filter-1.0.2.tgz", 105 | "integrity": "sha1-rwt5f/6+r4pSxmN87b6IFs/sG8g=", 106 | "dev": true 107 | }, 108 | "object-keys": { 109 | "version": "1.0.12", 110 | "resolved": "https://registry.npmjs.org/object-keys/-/object-keys-1.0.12.tgz", 111 | "integrity": "sha512-FTMyFUm2wBcGHnH2eXmz7tC6IwlqQZ6mVZ+6dm6vZ4IQIHjs6FdNsQBuKGPuUUUY6NfJw2PshC08Tn6LzLDOag==", 112 | "dev": true 113 | }, 114 | "object.assign": { 115 | "version": "4.1.0", 116 | "resolved": "https://registry.npmjs.org/object.assign/-/object.assign-4.1.0.tgz", 117 | "integrity": "sha512-exHJeq6kBKj58mqGyTQ9DFvrZC/eR6OwxzoM9YRoGBqrXYonaFyGiFMuc9VZrXf7DarreEwMpurG3dd+CNyW5w==", 118 | "dev": true, 119 | "requires": { 120 | "define-properties": "^1.1.2", 121 | "function-bind": "^1.1.1", 122 | "has-symbols": "^1.0.0", 123 | "object-keys": "^1.0.11" 124 | } 125 | }, 126 | "readline-sync": { 127 | "version": "1.4.9", 128 | "resolved": "https://registry.npmjs.org/readline-sync/-/readline-sync-1.4.9.tgz", 129 | "integrity": "sha1-PtqOZfI80qF+YTAbHwADOWr17No=" 130 | }, 131 | "run-parallel": { 132 | "version": "1.1.9", 133 | "resolved": "https://registry.npmjs.org/run-parallel/-/run-parallel-1.1.9.tgz", 134 | "integrity": "sha512-DEqnSRTDw/Tc3FXf49zedI638Z9onwUotBMiUFKmrO2sdFKIbXamXGQ3Axd4qgphxKB4kw/qP1w5kTxnfU1B9Q==", 135 | "dev": true 136 | }, 137 | "semver": { 138 | "version": "5.6.0", 139 | "resolved": "https://registry.npmjs.org/semver/-/semver-5.6.0.tgz", 140 | "integrity": "sha512-RS9R6R35NYgQn++fkDWaOmqGoj4Ek9gGs+DPxNUZKuwE183xjJroKvyo1IzVFeXvUrvmALy6FWD5xrdJT25gMg==", 141 | "dev": true 142 | }, 143 | "supports-color": { 144 | "version": "5.5.0", 145 | "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz", 146 | "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", 147 | "dev": true, 148 | "requires": { 149 | "has-flag": "^3.0.0" 150 | } 151 | } 152 | } 153 | } 154 | -------------------------------------------------------------------------------- /hangman/JavaScript/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "JavaScript", 3 | "version": "1.0.0", 4 | "description": "This is JavaScript Hangman refactoring code.", 5 | "main": "hangman.js", 6 | "scripts": { 7 | "start": "check-node-version --node \">= $(cat .nvmrc)\" && node hangman.js", 8 | "setup": "npm install", 9 | "test": "echo \"Error: no test specified\" && exit 1" 10 | }, 11 | "keywords": [], 12 | "author": "Yeonwoo Park", 13 | "license": "Apache-2.0", 14 | "dependencies": { 15 | "readline-sync": "^1.4.9" 16 | }, 17 | "devDependencies": { 18 | "check-node-version": "3.2.0" 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /hangman/JavaScript/readme.md: -------------------------------------------------------------------------------- 1 | # JavaScript Hangman Refactoring Code 2 | 3 | You need latest nodejs(v.10 or higher) and npm installed on your local machine. To check if you have installed nodejs, run the following commands : 4 | 5 | ```bash 6 | node -v (it should be v10 or higher) 7 | npm -v 8 | ``` 9 | 10 | Follow these steps to run this code : 11 | 12 | ```bash 13 | git clone https://github.com/floppylab/clean-code.git 14 | 15 | cd clean-code/hangman/JavaScript 16 | 17 | npm install 18 | 19 | node hangman.js 20 | ``` 21 | -------------------------------------------------------------------------------- /hangman/Kotlin/README.md: -------------------------------------------------------------------------------- 1 | To compile, you need Kotlin installed. 2 | 3 | * ```kotlinc hangman.kt -include-runtime -d hangman.jar``` 4 | 5 | To run, on the command line run the command ```java -jar hangman.jar```. 6 | -------------------------------------------------------------------------------- /hangman/Kotlin/hangman.kt: -------------------------------------------------------------------------------- 1 | import java.io.File 2 | import java.io.InputStream 3 | import java.util.concurrent.ThreadLocalRandom 4 | import java.util.Scanner 5 | 6 | fun main(args: Array) { 7 | val w = mutableListOf() 8 | val d = hashMapOf>() 9 | val inputStream: InputStream = File("resources/words.in").inputStream() 10 | 11 | try { 12 | inputStream.bufferedReader().useLines { lines -> lines.forEach { w.add(it.trim())} } 13 | 14 | for(e in w) { 15 | if(!d.containsKey(e.length)) { 16 | d.put(e.length, mutableListOf()) 17 | } 18 | d.get(e.length)!!.add(e) 19 | } 20 | 21 | print("Number of letters in the word? ") 22 | 23 | val l = readLine()!!.toInt() 24 | 25 | if(d.containsKey(l)) { 26 | val word = d.get(l)!!.get(ThreadLocalRandom.current().nextInt(0, d.get(l)!!.size)) 27 | 28 | val v = BooleanArray(l) 29 | var e = 0 30 | var done = true 31 | 32 | while(e < 10) { 33 | done = true 34 | for (bool_val in v) { 35 | if (!bool_val) { 36 | done = false 37 | } 38 | } 39 | if (done) { 40 | break 41 | } 42 | 43 | print("Guess a letter: ") 44 | 45 | val chr = Scanner(System.`in`).nextLine().get(0) 46 | 47 | var hit = false 48 | 49 | for(i in 0..(word.length-1)) { 50 | if(word.get(i) == chr && !v[i]) { 51 | v[i] = true 52 | hit = true 53 | } 54 | } 55 | 56 | if (hit) { 57 | println("Hit!") 58 | } else { 59 | println("Missed, mistake #${e+1} out of 10") 60 | 61 | ++e 62 | 63 | // drawing hangman 64 | println() 65 | if(e > 2) println(" xxxxxxxxxxxxx") 66 | else println() 67 | 68 | if(e > 3) println(" x x") 69 | else if (e > 1) println(" x") 70 | else println() 71 | 72 | if(e > 3) println(" x x") 73 | else if (e > 1) println(" x") 74 | else println() 75 | 76 | if(e>4) println(" xxx x") 77 | else if (e > 1) println(" x") 78 | else println() 79 | 80 | if(e>4) println(" xxxxx x") 81 | else if (e > 1) println(" x") 82 | else println() 83 | 84 | if(e>4) println(" xxx x") 85 | else if (e > 1) println(" x") 86 | else println() 87 | 88 | if(e>5) println(" x x") 89 | else if (e > 1) println(" x") 90 | else println() 91 | 92 | if(e>7) println(" x x x x") 93 | else if(e>6) println(" x x x") 94 | else if(e>5) println(" x x") 95 | else if (e > 1) println(" x") 96 | else println() 97 | 98 | if(e>7) println(" x x x x") 99 | else if(e>6) println(" x x x") 100 | else if(e>5) println(" x x") 101 | else if (e > 1) println(" x") 102 | else println() 103 | 104 | if(e>5) println(" x x") 105 | else if (e > 1) println(" x") 106 | else println() 107 | 108 | if(e>9) println(" x x x") 109 | else if(e>8) println(" x x") 110 | else if (e > 1) println(" x") 111 | else println() 112 | 113 | if(e>9) println(" x x x") 114 | else if(e>8) println(" x x") 115 | else if (e > 1) println(" x") 116 | else println() 117 | 118 | if(e>1) println(" x") 119 | else println() 120 | 121 | if(e>1) println(" x") 122 | else println() 123 | 124 | if(e>0) println("xxxxxxxxxxxxxxxxxxxxxxxxxxxx") 125 | else println() 126 | println() 127 | 128 | } 129 | print("The word: ") 130 | 131 | for(i in 0..(word.length-1)) { 132 | if (v[i]) { 133 | print(" " + word.get(i)+ " ") 134 | } else { 135 | print(" _ ") 136 | } 137 | } 138 | 139 | println("\n") 140 | } 141 | 142 | // printing final result 143 | if (done) { 144 | println("You won!") 145 | } else { 146 | println("You lost.") 147 | println("The word was: ${word}\n") 148 | } 149 | 150 | } else { 151 | println("Sorry, no words like that.") 152 | } 153 | } catch (ex: Exception) { 154 | ex.printStackTrace() 155 | } 156 | } -------------------------------------------------------------------------------- /hangman/Python/Hangman/.gitignore: -------------------------------------------------------------------------------- 1 | .idea/ 2 | Hangman1.py 3 | -------------------------------------------------------------------------------- /hangman/Python/Hangman/Hangman.py: -------------------------------------------------------------------------------- 1 | from random import randint 2 | 3 | F = open("resources/words.in") 4 | 5 | w = F.readlines() 6 | d = {} 7 | 8 | for i in range(len(w)): 9 | if len(w[i]) not in d: 10 | d[len(w[i])] = [] 11 | 12 | d[len(w[i])].append(w[i]) 13 | 14 | print("Number of letters in the word: ") 15 | l = int(input()) 16 | print(str(l)) 17 | 18 | if l in d: 19 | word = d[l][randint(0, len(w[l]))] 20 | v = [] 21 | for i in range(len(word)): 22 | v.append(False) 23 | 24 | e = 0 25 | done = True 26 | 27 | while e < 10: 28 | done = True 29 | 30 | for i in range(len(word)): 31 | if not v[i]: 32 | done = False 33 | 34 | if done: 35 | break 36 | 37 | print("Guess a letter: ") 38 | 39 | char = input()[0] 40 | 41 | hit = False 42 | for i in range(len(word)): 43 | if word[i] == char and not v[i]: 44 | v[i] = True 45 | hit = True 46 | 47 | if hit: 48 | print("Hit!") 49 | 50 | else: 51 | print("Missed. Mistake " + str(e+1) + " out of 10") 52 | e += 1 53 | 54 | print() 55 | if e > 2: 56 | print(" xxxxxxxxxxxxx") 57 | elif e > 1: 58 | print(" x x") 59 | else: 60 | print() 61 | 62 | if e > 3: 63 | print(" x x") 64 | elif e > 1: 65 | print(" x") 66 | else: 67 | print() 68 | 69 | if e > 4: 70 | print(" xxx x") 71 | elif e > 1: 72 | print(" x") 73 | else: 74 | print() 75 | 76 | if e > 4: 77 | print(" xxxxx x") 78 | elif e > 1: 79 | print(" x") 80 | else: 81 | print() 82 | 83 | if e > 4: 84 | print(" xxx x") 85 | elif e > 1: 86 | print(" x") 87 | else: 88 | print() 89 | 90 | if e > 5: 91 | print(" x x") 92 | elif e > 1: 93 | print(" x") 94 | else: 95 | print() 96 | 97 | if e > 7: 98 | print(" x x x x") 99 | elif e > 6: 100 | print(" x x x") 101 | 102 | if e > 7: 103 | print(" x x x x") 104 | elif e > 6: 105 | print(" x x x") 106 | elif e > 5: 107 | print(" x x") 108 | elif e > 1: 109 | print(" x") 110 | else: 111 | print() 112 | 113 | if e > 5: 114 | print(" x x") 115 | elif e > 1: 116 | print(" x") 117 | else: 118 | print() 119 | 120 | if e > 9: 121 | print(" x x x") 122 | elif e > 8: 123 | print(" x x") 124 | elif e > 1: 125 | print(" x") 126 | else: 127 | print() 128 | 129 | if e > 9: 130 | print(" x x x") 131 | elif e > 8: 132 | print(" x x") 133 | elif e > 1: 134 | print(" x") 135 | else: 136 | print() 137 | 138 | if e > 1: 139 | print(" x") 140 | else: 141 | print() 142 | 143 | if e > 1: 144 | print(" x") 145 | else: 146 | print() 147 | 148 | if e > 0: 149 | print("xxxxxxxxxxxxxxxxxxxxxxxxxxx") 150 | else: 151 | print() 152 | 153 | print() 154 | 155 | print("The word: ") 156 | hint = "" 157 | for i in range(len(word)): 158 | if v[i]: 159 | hint += " " + word[i] + " " 160 | else: 161 | hint += " _ " 162 | 163 | print(hint) 164 | print() 165 | 166 | if done: 167 | print("You won!") 168 | else: 169 | print("You lost.") 170 | print("The word was " + word) 171 | 172 | else: 173 | print("Sorry, no words like that") 174 | -------------------------------------------------------------------------------- /hangman/Python/Hangman/README.md: -------------------------------------------------------------------------------- 1 | ### Running Python code: 2 | 3 | Everything you'll need to do is to type on your terminal: 4 | 5 | `$ python Hangman.py` 6 | 7 | Alternatively, you could add a shebang (`#!`) on the header of your script, so your terminal can call the right interpreter to run your code: 8 | 9 | ```python 10 | #! /usr/bin/env python 11 | # -*- coding: utf-8 -*- 12 | ``` 13 | 14 | In addition you've got a line for setting the default enconding of your script. Now you could set the execute permission of your file: 15 | 16 | `$ chmod u+x Hangman.py` 17 | 18 | and then simply type on your terminal: 19 | 20 | `$ ./Hangman.py` 21 | -------------------------------------------------------------------------------- /hangman/README.md: -------------------------------------------------------------------------------- 1 | # Hangman 2 | 3 | A very simple command line game. The original code is not too long but it is buggy, unreadable and it is not easy to add a new feature. Simply said, it is a piece of legacy code you can improve your refactoring skills with. 4 | 5 | ## Steps to complete 6 | 7 | Each step should fit in 45-60 minutes. 8 | 9 | - Get to know the code, run it a few times, write some end-to-end tests 10 | - Try to make modules, extract methods, classes from the code 11 | - Write unit tests 12 | - Rethink style, rename variables, change used data structures 13 | - Refactor hangman drawing and communication with user, deal with error messages 14 | - Add new feature: storing letters and check if entered again 15 | 16 | ## Languages 17 | 18 | - [C#](C#) 19 | - [C++](C++) 20 | - [C](C) 21 | - [Go](Go) 22 | - [Groovy](Groovy) 23 | - [Java](Java) 24 | - [JavaScript](JavaScript) 25 | - [Kotlin](Kotlin) 26 | - [Python](Python) 27 | - [Rust](Rust) 28 | 29 | ## Contributions 30 | 31 | Feel free to add a new language to the list. Please try to keep the original mistakes, structure, so that everyone can work on the "exact same" bugs, making similar improvements. 32 | 33 | Don't forget to modify this README file and please add another README to the new folder. It should contain information on the tools needed and the steps how to run the code. 34 | 35 | ## Resources 36 | 37 | - list of words comes from [Word frequency data](https://www.wordfrequency.info/) 38 | -------------------------------------------------------------------------------- /hangman/Rust/.gitignore: -------------------------------------------------------------------------------- 1 | # Generated by Cargo 2 | # will have compiled files and executables 3 | /target/ 4 | 5 | # Remove Cargo.lock from gitignore if creating an executable, leave it for libraries 6 | # More information here https://doc.rust-lang.org/cargo/guide/cargo-toml-vs-cargo-lock.html 7 | Cargo.lock 8 | 9 | # These are backup files generated by rustfmt 10 | **/*.rs.bk 11 | -------------------------------------------------------------------------------- /hangman/Rust/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "hangman" 3 | version = "0.1.0" 4 | authors = ["Patrick Tone "] 5 | 6 | [dependencies] 7 | rand="0.5.5" -------------------------------------------------------------------------------- /hangman/Rust/resources/words.in: -------------------------------------------------------------------------------- 1 | abandon 2 | ability 3 | abortion 4 | abroad 5 | absence 6 | absolute 7 | absolutely 8 | absorb 9 | abstract 10 | academic 11 | accelerate 12 | accent 13 | accept 14 | acceptable 15 | acceptance 16 | access 17 | accessible 18 | accident 19 | accommodate 20 | accompany 21 | accomplish 22 | accomplishment 23 | according 24 | account 25 | accountability 26 | accounting 27 | accuracy 28 | accurate 29 | accurately 30 | accusation 31 | accuse 32 | achieve 33 | achievement 34 | acknowledge 35 | acquire 36 | acquisition 37 | across 38 | action 39 | active 40 | actively 41 | activist 42 | activity 43 | actress 44 | actual 45 | actually 46 | addition 47 | additional 48 | address 49 | adequate 50 | adjust 51 | adjustment 52 | administer 53 | administration 54 | administrative 55 | administrator 56 | admire 57 | admission 58 | adolescent 59 | adoption 60 | advance 61 | advanced 62 | advantage 63 | adventure 64 | advertising 65 | advice 66 | advise 67 | adviser 68 | advocate 69 | aesthetic 70 | affair 71 | affect 72 | afford 73 | afraid 74 | afternoon 75 | afterward 76 | against 77 | agency 78 | agenda 79 | aggression 80 | aggressive 81 | agreement 82 | agricultural 83 | agriculture 84 | aircraft 85 | airline 86 | airplane 87 | airport 88 | alcohol 89 | allegation 90 | alleged 91 | allegedly 92 | alliance 93 | almost 94 | alongside 95 | already 96 | alternative 97 | although 98 | altogether 99 | aluminum 100 | always 101 | amazing 102 | ambassador 103 | ambition 104 | ambitious 105 | amendment 106 | amount 107 | analysis 108 | analyst 109 | analyze 110 | ancestor 111 | ancient 112 | and/or 113 | animal 114 | anniversary 115 | announce 116 | announcement 117 | annual 118 | annually 119 | anonymous 120 | another 121 | answer 122 | anticipate 123 | anxiety 124 | anxious 125 | anybody 126 | anymore 127 | anyone 128 | anything 129 | anyway 130 | anywhere 131 | apartment 132 | apologize 133 | apology 134 | apparent 135 | apparently 136 | appeal 137 | appear 138 | appearance 139 | application 140 | appoint 141 | appointment 142 | appreciate 143 | appreciation 144 | approach 145 | appropriate 146 | approval 147 | approve 148 | approximately 149 | architect 150 | architecture 151 | argument 152 | around 153 | arrange 154 | arrangement 155 | arrest 156 | arrival 157 | arrive 158 | article 159 | articulate 160 | artifact 161 | artificial 162 | artist 163 | artistic 164 | asleep 165 | aspect 166 | assault 167 | assemble 168 | assembly 169 | assert 170 | assess 171 | assessment 172 | assign 173 | assignment 174 | assist 175 | assistance 176 | assistant 177 | associate 178 | associated 179 | association 180 | assume 181 | assumption 182 | assure 183 | astronomer 184 | athlete 185 | athletic 186 | atmosphere 187 | attach 188 | attack 189 | attempt 190 | attend 191 | attendance 192 | attention 193 | attitude 194 | attorney 195 | attract 196 | attraction 197 | attractive 198 | attribute 199 | auction 200 | audience 201 | author 202 | authority 203 | authorize 204 | automatic 205 | automatically 206 | automobile 207 | autonomy 208 | availability 209 | available 210 | average 211 | awareness 212 | background 213 | backyard 214 | bacteria 215 | balance 216 | balanced 217 | balloon 218 | ballot 219 | banana 220 | banker 221 | banking 222 | bankruptcy 223 | barely 224 | barrel 225 | barrier 226 | baseball 227 | basement 228 | basically 229 | basket 230 | basketball 231 | bathroom 232 | battery 233 | battle 234 | beautiful 235 | beauty 236 | because 237 | become 238 | bedroom 239 | before 240 | beginning 241 | behalf 242 | behave 243 | behavior 244 | behavioral 245 | behind 246 | belief 247 | believe 248 | belong 249 | beneath 250 | benefit 251 | beside 252 | besides 253 | better 254 | between 255 | beyond 256 | bicycle 257 | billion 258 | biography 259 | biological 260 | biology 261 | birthday 262 | bishop 263 | bitter 264 | blanket 265 | blessing 266 | bloody 267 | bombing 268 | border 269 | boring 270 | borrow 271 | bother 272 | bottle 273 | bottom 274 | bounce 275 | boundary 276 | boyfriend 277 | branch 278 | breakfast 279 | breast 280 | breath 281 | breathe 282 | breathing 283 | breeze 284 | bridge 285 | briefly 286 | bright 287 | brilliant 288 | broadcast 289 | broken 290 | broker 291 | bronze 292 | brother 293 | brutal 294 | bubble 295 | bucket 296 | budget 297 | builder 298 | building 299 | bullet 300 | burden 301 | bureau 302 | burning 303 | business 304 | businessman 305 | butter 306 | butterfly 307 | button 308 | cabinet 309 | calculate 310 | calculation 311 | calendar 312 | camera 313 | campaign 314 | campus 315 | cancel 316 | cancer 317 | candidate 318 | candle 319 | canvas 320 | capability 321 | capable 322 | capacity 323 | capital 324 | captain 325 | capture 326 | carbohydrate 327 | carbon 328 | career 329 | careful 330 | carefully 331 | carpet 332 | carrier 333 | carrot 334 | cartoon 335 | casino 336 | casual 337 | casualty 338 | catalog 339 | category 340 | cattle 341 | ceiling 342 | celebrate 343 | celebration 344 | celebrity 345 | cemetery 346 | center 347 | central 348 | century 349 | ceremony 350 | certain 351 | certainly 352 | chairman 353 | challenge 354 | chamber 355 | champion 356 | championship 357 | chance 358 | change 359 | changing 360 | channel 361 | chapter 362 | character 363 | characteristic 364 | characterize 365 | charge 366 | charity 367 | charter 368 | cheese 369 | chemical 370 | chemistry 371 | chicken 372 | childhood 373 | chocolate 374 | choice 375 | cholesterol 376 | choose 377 | chronic 378 | church 379 | cigarette 380 | circle 381 | circuit 382 | circumstance 383 | citizen 384 | citizenship 385 | civilian 386 | civilization 387 | classic 388 | classical 389 | classify 390 | classroom 391 | clearly 392 | client 393 | climate 394 | clinic 395 | clinical 396 | closed 397 | closely 398 | closer 399 | closest 400 | closet 401 | clothes 402 | clothing 403 | cluster 404 | coalition 405 | coastal 406 | cocaine 407 | coffee 408 | cognitive 409 | collaboration 410 | collapse 411 | collar 412 | colleague 413 | collect 414 | collection 415 | collective 416 | collector 417 | college 418 | colonial 419 | colony 420 | colorful 421 | column 422 | columnist 423 | combat 424 | combination 425 | combine 426 | combined 427 | comedy 428 | comfort 429 | comfortable 430 | coming 431 | command 432 | commander 433 | comment 434 | commercial 435 | commission 436 | commissioner 437 | commit 438 | commitment 439 | committee 440 | commodity 441 | common 442 | commonly 443 | communicate 444 | communication 445 | community 446 | companion 447 | company 448 | comparable 449 | compare 450 | comparison 451 | compel 452 | compelling 453 | compensation 454 | compete 455 | competition 456 | competitive 457 | competitor 458 | complain 459 | complaint 460 | complete 461 | completely 462 | complex 463 | complexity 464 | compliance 465 | complicated 466 | comply 467 | component 468 | compose 469 | composition 470 | compound 471 | comprehensive 472 | comprise 473 | compromise 474 | computer 475 | concede 476 | conceive 477 | concentrate 478 | concentration 479 | concept 480 | conception 481 | concern 482 | concerned 483 | concerning 484 | concert 485 | conclude 486 | conclusion 487 | concrete 488 | condemn 489 | condition 490 | conduct 491 | conference 492 | confess 493 | confession 494 | confidence 495 | confident 496 | confirm 497 | conflict 498 | confront 499 | confrontation 500 | confuse 501 | confusion 502 | congressional 503 | connect 504 | connection 505 | conscience 506 | conscious 507 | consciousness 508 | consecutive 509 | consensus 510 | consent 511 | consequence 512 | consequently 513 | conservation 514 | conservative 515 | consider 516 | considerable 517 | considerably 518 | consideration 519 | consist 520 | consistent 521 | consistently 522 | conspiracy 523 | constant 524 | constantly 525 | constitute 526 | constitution 527 | constitutional 528 | constraint 529 | construct 530 | construction 531 | consult 532 | consultant 533 | consume 534 | consumer 535 | consumption 536 | contact 537 | contain 538 | container 539 | contemplate 540 | contemporary 541 | contend 542 | content 543 | contest 544 | context 545 | continent 546 | continue 547 | continued 548 | continuing 549 | continuous 550 | contract 551 | contractor 552 | contrast 553 | contribute 554 | contribution 555 | contributor 556 | control 557 | controversial 558 | controversy 559 | convenience 560 | convention 561 | conventional 562 | conversation 563 | conversion 564 | convert 565 | convey 566 | convict 567 | conviction 568 | convince 569 | convinced 570 | cookie 571 | cooking 572 | cooperate 573 | cooperation 574 | cooperative 575 | coordinate 576 | coordinator 577 | corner 578 | corporate 579 | corporation 580 | correct 581 | correctly 582 | correlation 583 | correspondent 584 | corridor 585 | corruption 586 | costly 587 | costume 588 | cottage 589 | cotton 590 | council 591 | counsel 592 | counseling 593 | counselor 594 | counter 595 | counterpart 596 | country 597 | county 598 | couple 599 | courage 600 | course 601 | courtroom 602 | cousin 603 | coverage 604 | create 605 | creation 606 | creative 607 | creativity 608 | creature 609 | credibility 610 | credit 611 | criminal 612 | crisis 613 | criteria 614 | critic 615 | critical 616 | criticism 617 | criticize 618 | crowded 619 | crucial 620 | cruise 621 | crystal 622 | cultural 623 | culture 624 | curiosity 625 | curious 626 | currency 627 | current 628 | currently 629 | curriculum 630 | curtain 631 | custody 632 | custom 633 | customer 634 | damage 635 | dancer 636 | dancing 637 | danger 638 | dangerous 639 | darkness 640 | database 641 | daughter 642 | deadline 643 | deadly 644 | dealer 645 | debate 646 | debris 647 | decade 648 | decent 649 | decide 650 | decision 651 | declare 652 | decline 653 | decorate 654 | decrease 655 | dedicate 656 | deeply 657 | defeat 658 | defend 659 | defendant 660 | defender 661 | defense 662 | defensive 663 | deficit 664 | define 665 | definitely 666 | definition 667 | degree 668 | deliberately 669 | delicate 670 | delight 671 | deliver 672 | delivery 673 | demand 674 | democracy 675 | democratic 676 | demographic 677 | demonstrate 678 | demonstration 679 | denial 680 | density 681 | depart 682 | department 683 | departure 684 | depend 685 | dependent 686 | depending 687 | depict 688 | deploy 689 | deposit 690 | depressed 691 | depression 692 | deputy 693 | derive 694 | descend 695 | describe 696 | description 697 | desert 698 | deserve 699 | design 700 | designer 701 | desire 702 | desperate 703 | desperately 704 | despite 705 | dessert 706 | destination 707 | destroy 708 | destruction 709 | detail 710 | detailed 711 | detect 712 | detective 713 | determination 714 | determine 715 | devastating 716 | develop 717 | developer 718 | developing 719 | development 720 | developmental 721 | device 722 | devote 723 | diabetes 724 | diagnose 725 | diagnosis 726 | dialogue 727 | diamond 728 | dictate 729 | differ 730 | difference 731 | different 732 | differently 733 | difficult 734 | difficulty 735 | digital 736 | dignity 737 | dilemma 738 | dimension 739 | diminish 740 | dining 741 | dinner 742 | diplomat 743 | diplomatic 744 | direct 745 | direction 746 | directly 747 | director 748 | disability 749 | disabled 750 | disagree 751 | disappear 752 | disappointed 753 | disappointment 754 | disaster 755 | discipline 756 | disclose 757 | discount 758 | discourage 759 | discourse 760 | discover 761 | discovery 762 | discrimination 763 | discuss 764 | discussion 765 | disease 766 | dismiss 767 | disorder 768 | display 769 | dispute 770 | dissolve 771 | distance 772 | distant 773 | distinct 774 | distinction 775 | distinctive 776 | distinguish 777 | distract 778 | distribute 779 | distribution 780 | district 781 | disturb 782 | disturbing 783 | diverse 784 | diversity 785 | divide 786 | divine 787 | division 788 | divorce 789 | doctor 790 | doctrine 791 | document 792 | documentary 793 | domain 794 | domestic 795 | dominant 796 | dominate 797 | donate 798 | donation 799 | doorway 800 | double 801 | downtown 802 | dramatic 803 | dramatically 804 | drawer 805 | drawing 806 | drinking 807 | driver 808 | driveway 809 | driving 810 | during 811 | dynamic 812 | dynamics 813 | earnings 814 | earthquake 815 | easily 816 | eastern 817 | eating 818 | ecological 819 | economic 820 | economically 821 | economics 822 | economist 823 | economy 824 | ecosystem 825 | edition 826 | editor 827 | educate 828 | education 829 | educational 830 | educator 831 | effect 832 | effective 833 | effectively 834 | effectiveness 835 | efficiency 836 | efficient 837 | effort 838 | eighth 839 | either 840 | elaborate 841 | elderly 842 | election 843 | electric 844 | electrical 845 | electricity 846 | electronic 847 | electronics 848 | elegant 849 | element 850 | elementary 851 | elephant 852 | elevator 853 | eleven 854 | eligible 855 | eliminate 856 | elsewhere 857 | embarrassed 858 | embrace 859 | emerge 860 | emergency 861 | emerging 862 | emission 863 | emotion 864 | emotional 865 | emotionally 866 | emphasis 867 | emphasize 868 | empire 869 | employ 870 | employee 871 | employer 872 | employment 873 | enable 874 | encounter 875 | encourage 876 | encouraging 877 | endless 878 | endorse 879 | endure 880 | energy 881 | enforce 882 | enforcement 883 | engage 884 | engagement 885 | engine 886 | engineer 887 | engineering 888 | enhance 889 | enormous 890 | enough 891 | enroll 892 | ensure 893 | enterprise 894 | entertainment 895 | enthusiasm 896 | entire 897 | entirely 898 | entitle 899 | entity 900 | entrance 901 | entrepreneur 902 | envelope 903 | environment 904 | environmental 905 | envision 906 | epidemic 907 | episode 908 | equality 909 | equally 910 | equation 911 | equipment 912 | equity 913 | equivalent 914 | escape 915 | especially 916 | essence 917 | essential 918 | essentially 919 | establish 920 | establishment 921 | estate 922 | estimate 923 | estimated 924 | ethical 925 | ethics 926 | ethnic 927 | evaluate 928 | evaluation 929 | evening 930 | eventually 931 | everybody 932 | everyday 933 | everyone 934 | everything 935 | everywhere 936 | evidence 937 | evident 938 | evolution 939 | evolve 940 | exactly 941 | examination 942 | examine 943 | example 944 | exceed 945 | excellent 946 | except 947 | exception 948 | excessive 949 | exchange 950 | excited 951 | excitement 952 | exciting 953 | exclude 954 | exclusive 955 | exclusively 956 | excuse 957 | execute 958 | execution 959 | executive 960 | exercise 961 | exhaust 962 | exhibit 963 | exhibition 964 | existence 965 | existing 966 | exotic 967 | expand 968 | expansion 969 | expect 970 | expectation 971 | expected 972 | expedition 973 | expense 974 | expensive 975 | experience 976 | experienced 977 | experiment 978 | experimental 979 | expert 980 | expertise 981 | explain 982 | explanation 983 | explicit 984 | explode 985 | exploit 986 | exploration 987 | explore 988 | explosion 989 | export 990 | expose 991 | exposure 992 | express 993 | expression 994 | extend 995 | extended 996 | extension 997 | extensive 998 | extent 999 | external 1000 | extraordinary 1001 | extreme 1002 | extremely 1003 | eyebrow 1004 | fabric 1005 | facilitate 1006 | facility 1007 | factor 1008 | factory 1009 | faculty 1010 | failure 1011 | fairly 1012 | familiar 1013 | family 1014 | famous 1015 | fantastic 1016 | fantasy 1017 | farmer 1018 | fascinating 1019 | fashion 1020 | faster 1021 | father 1022 | fatigue 1023 | favorable 1024 | favorite 1025 | feather 1026 | feature 1027 | federal 1028 | feedback 1029 | feeling 1030 | fellow 1031 | female 1032 | feminist 1033 | festival 1034 | fiction 1035 | fierce 1036 | fifteen 1037 | fighter 1038 | fighting 1039 | figure 1040 | filter 1041 | finally 1042 | finance 1043 | financial 1044 | finding 1045 | finger 1046 | finish 1047 | firmly 1048 | fiscal 1049 | fisherman 1050 | fishing 1051 | fitness 1052 | flavor 1053 | flexibility 1054 | flexible 1055 | flight 1056 | flower 1057 | flying 1058 | follow 1059 | following 1060 | football 1061 | forbid 1062 | forehead 1063 | foreign 1064 | foreigner 1065 | forest 1066 | forever 1067 | forget 1068 | forgive 1069 | formal 1070 | format 1071 | formation 1072 | former 1073 | formerly 1074 | formula 1075 | fortunately 1076 | fortune 1077 | forward 1078 | foster 1079 | foundation 1080 | founder 1081 | fourth 1082 | fraction 1083 | fragile 1084 | fragment 1085 | framework 1086 | franchise 1087 | frankly 1088 | freedom 1089 | freely 1090 | freeze 1091 | frequency 1092 | frequent 1093 | frequently 1094 | freshman 1095 | friend 1096 | friendly 1097 | friendship 1098 | frontier 1099 | frozen 1100 | frustrate 1101 | frustration 1102 | fucking 1103 | function 1104 | functional 1105 | fundamental 1106 | funding 1107 | funeral 1108 | furniture 1109 | furthermore 1110 | future 1111 | galaxy 1112 | gallery 1113 | garage 1114 | garbage 1115 | garden 1116 | garlic 1117 | gasoline 1118 | gather 1119 | gathering 1120 | gender 1121 | general 1122 | generally 1123 | generate 1124 | generation 1125 | generous 1126 | genetic 1127 | genius 1128 | gentle 1129 | gentleman 1130 | gently 1131 | genuine 1132 | gesture 1133 | gifted 1134 | girlfriend 1135 | glance 1136 | glimpse 1137 | global 1138 | golden 1139 | govern 1140 | government 1141 | governor 1142 | gradually 1143 | graduate 1144 | graduation 1145 | grandchild 1146 | grandfather 1147 | grandmother 1148 | grandparent 1149 | grateful 1150 | gravity 1151 | greatest 1152 | greatly 1153 | grocery 1154 | ground 1155 | growing 1156 | growth 1157 | guarantee 1158 | guidance 1159 | guideline 1160 | guilty 1161 | guitar 1162 | habitat 1163 | halfway 1164 | hallway 1165 | handful 1166 | handle 1167 | handsome 1168 | happen 1169 | happily 1170 | happiness 1171 | harassment 1172 | hardly 1173 | hardware 1174 | harmony 1175 | harvest 1176 | hazard 1177 | headache 1178 | headline 1179 | headquarters 1180 | health 1181 | healthy 1182 | hearing 1183 | heaven 1184 | heavily 1185 | height 1186 | helicopter 1187 | helmet 1188 | helpful 1189 | heritage 1190 | herself 1191 | hesitate 1192 | hidden 1193 | highlight 1194 | highly 1195 | highway 1196 | himself 1197 | historian 1198 | historic 1199 | historical 1200 | historically 1201 | history 1202 | hockey 1203 | holiday 1204 | homeland 1205 | homeless 1206 | homework 1207 | honest 1208 | honestly 1209 | hopefully 1210 | horizon 1211 | hormone 1212 | horrible 1213 | horror 1214 | hospital 1215 | hostage 1216 | hostile 1217 | household 1218 | housing 1219 | however 1220 | humanity 1221 | hundred 1222 | hunger 1223 | hungry 1224 | hunter 1225 | hunting 1226 | hurricane 1227 | husband 1228 | hypothesis 1229 | identical 1230 | identification 1231 | identify 1232 | identity 1233 | ideological 1234 | ideology 1235 | ignore 1236 | illegal 1237 | illness 1238 | illusion 1239 | illustrate 1240 | imagination 1241 | imagine 1242 | immediate 1243 | immediately 1244 | immigrant 1245 | immigration 1246 | immune 1247 | impact 1248 | implement 1249 | implementation 1250 | implication 1251 | import 1252 | importance 1253 | important 1254 | importantly 1255 | impose 1256 | impossible 1257 | impress 1258 | impression 1259 | impressive 1260 | improve 1261 | improved 1262 | improvement 1263 | impulse 1264 | incentive 1265 | incident 1266 | include 1267 | including 1268 | income 1269 | incorporate 1270 | increase 1271 | increased 1272 | increasing 1273 | increasingly 1274 | incredible 1275 | incredibly 1276 | indeed 1277 | independence 1278 | independent 1279 | indicate 1280 | indication 1281 | indicator 1282 | indigenous 1283 | individual 1284 | industrial 1285 | industry 1286 | inevitable 1287 | inevitably 1288 | infant 1289 | infection 1290 | inflation 1291 | influence 1292 | influential 1293 | inform 1294 | informal 1295 | information 1296 | infrastructure 1297 | ingredient 1298 | inherent 1299 | inherit 1300 | initial 1301 | initially 1302 | initiate 1303 | initiative 1304 | injure 1305 | injury 1306 | inmate 1307 | innocent 1308 | innovation 1309 | innovative 1310 | inquiry 1311 | insect 1312 | insert 1313 | inside 1314 | insight 1315 | insist 1316 | inspection 1317 | inspector 1318 | inspiration 1319 | inspire 1320 | install 1321 | installation 1322 | instance 1323 | instant 1324 | instantly 1325 | instead 1326 | instinct 1327 | institution 1328 | institutional 1329 | instruct 1330 | instruction 1331 | instructional 1332 | instructor 1333 | instrument 1334 | insurance 1335 | intact 1336 | integrate 1337 | integrated 1338 | integration 1339 | integrity 1340 | intellectual 1341 | intelligence 1342 | intelligent 1343 | intend 1344 | intense 1345 | intensity 1346 | intent 1347 | intention 1348 | interact 1349 | interaction 1350 | interest 1351 | interested 1352 | interesting 1353 | interfere 1354 | interior 1355 | internal 1356 | international 1357 | interpret 1358 | interpretation 1359 | interrupt 1360 | interval 1361 | intervention 1362 | interview 1363 | intimate 1364 | introduce 1365 | introduction 1366 | invade 1367 | invasion 1368 | invent 1369 | invention 1370 | inventory 1371 | invest 1372 | investigate 1373 | investigation 1374 | investigator 1375 | investment 1376 | investor 1377 | invisible 1378 | invitation 1379 | invite 1380 | involve 1381 | involved 1382 | involvement 1383 | ironically 1384 | island 1385 | isolate 1386 | isolated 1387 | isolation 1388 | itself 1389 | jacket 1390 | jewelry 1391 | journal 1392 | journalism 1393 | journalist 1394 | journey 1395 | judgment 1396 | judicial 1397 | jungle 1398 | junior 1399 | jurisdiction 1400 | justice 1401 | justify 1402 | killer 1403 | killing 1404 | kingdom 1405 | kitchen 1406 | knowledge 1407 | laboratory 1408 | ladder 1409 | landing 1410 | landmark 1411 | landscape 1412 | language 1413 | largely 1414 | lately 1415 | latter 1416 | laughter 1417 | launch 1418 | laundry 1419 | lawmaker 1420 | lawsuit 1421 | lawyer 1422 | leader 1423 | leadership 1424 | leading 1425 | league 1426 | learning 1427 | leather 1428 | lecture 1429 | legacy 1430 | legally 1431 | legend 1432 | legislation 1433 | legislative 1434 | legislator 1435 | legislature 1436 | legitimate 1437 | length 1438 | lesson 1439 | letter 1440 | liability 1441 | liberal 1442 | liberty 1443 | library 1444 | license 1445 | lifestyle 1446 | lifetime 1447 | lighting 1448 | lightly 1449 | lightning 1450 | likelihood 1451 | likely 1452 | likewise 1453 | limitation 1454 | limited 1455 | liquid 1456 | listen 1457 | listener 1458 | literally 1459 | literary 1460 | literature 1461 | little 1462 | living 1463 | locate 1464 | location 1465 | logical 1466 | lonely 1467 | longtime 1468 | lovely 1469 | loyalty 1470 | machine 1471 | magazine 1472 | magnetic 1473 | magnitude 1474 | mainly 1475 | mainstream 1476 | maintain 1477 | maintenance 1478 | majority 1479 | makeup 1480 | manage 1481 | management 1482 | manager 1483 | managing 1484 | mandate 1485 | manipulate 1486 | manner 1487 | mansion 1488 | manual 1489 | manufacturer 1490 | manufacturing 1491 | marble 1492 | margin 1493 | marine 1494 | marker 1495 | market 1496 | marketing 1497 | marketplace 1498 | marriage 1499 | married 1500 | massive 1501 | master 1502 | material 1503 | mathematics 1504 | matter 1505 | maximum 1506 | meaning 1507 | meaningful 1508 | meantime 1509 | meanwhile 1510 | measure 1511 | measurement 1512 | mechanic 1513 | mechanical 1514 | mechanism 1515 | medical 1516 | medication 1517 | medicine 1518 | medium 1519 | meeting 1520 | member 1521 | membership 1522 | memory 1523 | mental 1524 | mentally 1525 | mention 1526 | mentor 1527 | merchant 1528 | merely 1529 | message 1530 | metaphor 1531 | method 1532 | metropolitan 1533 | middle 1534 | midnight 1535 | migration 1536 | military 1537 | million 1538 | mineral 1539 | minimal 1540 | minimize 1541 | minimum 1542 | minister 1543 | ministry 1544 | minority 1545 | minute 1546 | miracle 1547 | mirror 1548 | missile 1549 | missing 1550 | mission 1551 | missionary 1552 | mistake 1553 | mixture 1554 | mobile 1555 | moderate 1556 | modern 1557 | modest 1558 | modify 1559 | molecule 1560 | moment 1561 | momentum 1562 | monitor 1563 | monkey 1564 | monster 1565 | monthly 1566 | monument 1567 | moreover 1568 | morning 1569 | mortality 1570 | mortgage 1571 | mostly 1572 | mother 1573 | motion 1574 | motivate 1575 | motivation 1576 | motive 1577 | mountain 1578 | movement 1579 | multiple 1580 | municipal 1581 | murder 1582 | muscle 1583 | museum 1584 | mushroom 1585 | musical 1586 | musician 1587 | mutter 1588 | mutual 1589 | myself 1590 | mysterious 1591 | mystery 1592 | narrative 1593 | narrow 1594 | nation 1595 | national 1596 | nationwide 1597 | native 1598 | natural 1599 | naturally 1600 | nature 1601 | nearby 1602 | nearly 1603 | necessarily 1604 | necessary 1605 | necessity 1606 | needle 1607 | negative 1608 | negotiate 1609 | negotiation 1610 | neighbor 1611 | neighborhood 1612 | neighboring 1613 | neither 1614 | nervous 1615 | network 1616 | neutral 1617 | nevertheless 1618 | newspaper 1619 | nightmare 1620 | nobody 1621 | nomination 1622 | nominee 1623 | nonetheless 1624 | nonprofit 1625 | normal 1626 | normally 1627 | northeast 1628 | northern 1629 | northwest 1630 | notebook 1631 | nothing 1632 | notice 1633 | notion 1634 | nowhere 1635 | nuclear 1636 | number 1637 | numerous 1638 | nutrient 1639 | object 1640 | objection 1641 | objective 1642 | obligation 1643 | observation 1644 | observe 1645 | observer 1646 | obstacle 1647 | obtain 1648 | obvious 1649 | obviously 1650 | occasion 1651 | occasional 1652 | occasionally 1653 | occupation 1654 | occupy 1655 | o'clock 1656 | offender 1657 | offense 1658 | offensive 1659 | offering 1660 | office 1661 | officer 1662 | official 1663 | officially 1664 | ongoing 1665 | online 1666 | opening 1667 | openly 1668 | operate 1669 | operating 1670 | operation 1671 | operator 1672 | opinion 1673 | opponent 1674 | opportunity 1675 | oppose 1676 | opposed 1677 | opposite 1678 | opposition 1679 | optimistic 1680 | option 1681 | orange 1682 | ordinary 1683 | organic 1684 | organism 1685 | organization 1686 | organizational 1687 | organize 1688 | organized 1689 | orientation 1690 | origin 1691 | original 1692 | originally 1693 | others 1694 | otherwise 1695 | ourselves 1696 | outcome 1697 | outdoor 1698 | outfit 1699 | outlet 1700 | outline 1701 | output 1702 | outside 1703 | outsider 1704 | outstanding 1705 | overall 1706 | overcome 1707 | overlook 1708 | overnight 1709 | oversee 1710 | overwhelm 1711 | overwhelming 1712 | ownership 1713 | oxygen 1714 | package 1715 | painful 1716 | painter 1717 | painting 1718 | palace 1719 | parade 1720 | parent 1721 | parental 1722 | parish 1723 | parking 1724 | partial 1725 | partially 1726 | participant 1727 | participate 1728 | participation 1729 | particle 1730 | particular 1731 | particularly 1732 | partly 1733 | partner 1734 | partnership 1735 | passage 1736 | passenger 1737 | passing 1738 | passion 1739 | pastor 1740 | patent 1741 | patience 1742 | patient 1743 | patrol 1744 | patron 1745 | pattern 1746 | payment 1747 | peaceful 1748 | peanut 1749 | peasant 1750 | penalty 1751 | pencil 1752 | pension 1753 | people 1754 | pepper 1755 | perceive 1756 | perceived 1757 | percentage 1758 | perception 1759 | perfect 1760 | perfectly 1761 | perform 1762 | performance 1763 | performer 1764 | perhaps 1765 | period 1766 | permanent 1767 | permission 1768 | permit 1769 | persist 1770 | person 1771 | personal 1772 | personality 1773 | personally 1774 | personnel 1775 | perspective 1776 | persuade 1777 | phenomenon 1778 | philosophical 1779 | philosophy 1780 | photograph 1781 | photographer 1782 | photography 1783 | phrase 1784 | physical 1785 | physically 1786 | physician 1787 | physics 1788 | pickup 1789 | picture 1790 | pillow 1791 | pioneer 1792 | pistol 1793 | pitcher 1794 | placement 1795 | plaintiff 1796 | planet 1797 | planner 1798 | planning 1799 | plastic 1800 | platform 1801 | player 1802 | playoff 1803 | pleasant 1804 | please 1805 | pleased 1806 | pleasure 1807 | plenty 1808 | plunge 1809 | pocket 1810 | poetry 1811 | police 1812 | policeman 1813 | policy 1814 | political 1815 | politically 1816 | politician 1817 | politics 1818 | pollution 1819 | popular 1820 | popularity 1821 | population 1822 | portfolio 1823 | portion 1824 | portrait 1825 | portray 1826 | position 1827 | positive 1828 | possess 1829 | possession 1830 | possibility 1831 | possible 1832 | possibly 1833 | poster 1834 | potato 1835 | potential 1836 | potentially 1837 | poverty 1838 | powder 1839 | powerful 1840 | practical 1841 | practically 1842 | practice 1843 | practitioner 1844 | praise 1845 | prayer 1846 | preach 1847 | precious 1848 | precise 1849 | precisely 1850 | predator 1851 | predict 1852 | prediction 1853 | prefer 1854 | preference 1855 | pregnancy 1856 | pregnant 1857 | preliminary 1858 | premise 1859 | premium 1860 | preparation 1861 | prepare 1862 | prescription 1863 | presence 1864 | present 1865 | presentation 1866 | preserve 1867 | presidency 1868 | president 1869 | presidential 1870 | pressure 1871 | presumably 1872 | pretend 1873 | pretty 1874 | prevail 1875 | prevent 1876 | prevention 1877 | previous 1878 | previously 1879 | priest 1880 | primarily 1881 | primary 1882 | principal 1883 | principle 1884 | priority 1885 | prison 1886 | prisoner 1887 | privacy 1888 | private 1889 | privately 1890 | privilege 1891 | probably 1892 | problem 1893 | procedure 1894 | proceed 1895 | process 1896 | processing 1897 | processor 1898 | proclaim 1899 | produce 1900 | producer 1901 | product 1902 | production 1903 | productive 1904 | productivity 1905 | profession 1906 | professional 1907 | professor 1908 | profile 1909 | profit 1910 | profound 1911 | program 1912 | programming 1913 | progress 1914 | progressive 1915 | prohibit 1916 | project 1917 | projection 1918 | prominent 1919 | promise 1920 | promising 1921 | promote 1922 | promotion 1923 | prompt 1924 | proper 1925 | properly 1926 | property 1927 | proportion 1928 | proposal 1929 | propose 1930 | proposed 1931 | prosecution 1932 | prosecutor 1933 | prospect 1934 | protect 1935 | protection 1936 | protective 1937 | protein 1938 | protest 1939 | protocol 1940 | provide 1941 | provided 1942 | provider 1943 | province 1944 | provision 1945 | provoke 1946 | psychological 1947 | psychologist 1948 | psychology 1949 | public 1950 | publication 1951 | publicity 1952 | publicly 1953 | publish 1954 | publisher 1955 | punish 1956 | punishment 1957 | purchase 1958 | purple 1959 | purpose 1960 | pursue 1961 | pursuit 1962 | puzzle 1963 | qualify 1964 | quality 1965 | quantity 1966 | quarter 1967 | quarterback 1968 | question 1969 | questionnaire 1970 | quickly 1971 | quietly 1972 | rabbit 1973 | racial 1974 | racism 1975 | radiation 1976 | radical 1977 | railroad 1978 | random 1979 | rapidly 1980 | rarely 1981 | rather 1982 | rating 1983 | rational 1984 | reaction 1985 | reader 1986 | readily 1987 | reading 1988 | realistic 1989 | reality 1990 | realize 1991 | really 1992 | reason 1993 | reasonable 1994 | rebuild 1995 | recall 1996 | receive 1997 | receiver 1998 | recent 1999 | recently 2000 | reception 2001 | recession 2002 | recipe 2003 | recipient 2004 | recognition 2005 | recognize 2006 | recommend 2007 | recommendation 2008 | record 2009 | recording 2010 | recover 2011 | recovery 2012 | recruit 2013 | reduce 2014 | reduction 2015 | reference 2016 | reflect 2017 | reflection 2018 | reform 2019 | refrigerator 2020 | refuge 2021 | refugee 2022 | refuse 2023 | regain 2024 | regard 2025 | regarding 2026 | regardless 2027 | regime 2028 | region 2029 | regional 2030 | register 2031 | regret 2032 | regular 2033 | regularly 2034 | regulate 2035 | regulation 2036 | regulator 2037 | regulatory 2038 | rehabilitation 2039 | reinforce 2040 | reject 2041 | relate 2042 | related 2043 | relation 2044 | relationship 2045 | relative 2046 | relatively 2047 | release 2048 | relevant 2049 | reliability 2050 | reliable 2051 | relief 2052 | relieve 2053 | religion 2054 | religious 2055 | reluctant 2056 | remain 2057 | remaining 2058 | remark 2059 | remarkable 2060 | remember 2061 | remind 2062 | reminder 2063 | remote 2064 | removal 2065 | remove 2066 | render 2067 | rental 2068 | repair 2069 | repeat 2070 | repeatedly 2071 | replace 2072 | replacement 2073 | report 2074 | reportedly 2075 | reporter 2076 | reporting 2077 | represent 2078 | representation 2079 | representative 2080 | republic 2081 | reputation 2082 | request 2083 | require 2084 | required 2085 | requirement 2086 | rescue 2087 | research 2088 | researcher 2089 | resemble 2090 | reservation 2091 | reserve 2092 | residence 2093 | resident 2094 | residential 2095 | resign 2096 | resist 2097 | resistance 2098 | resolution 2099 | resolve 2100 | resort 2101 | resource 2102 | respect 2103 | respectively 2104 | respond 2105 | respondent 2106 | response 2107 | responsibility 2108 | responsible 2109 | restaurant 2110 | restore 2111 | restrict 2112 | restriction 2113 | result 2114 | resume 2115 | retail 2116 | retailer 2117 | retain 2118 | retire 2119 | retired 2120 | retirement 2121 | retreat 2122 | return 2123 | reveal 2124 | revelation 2125 | revenue 2126 | reverse 2127 | review 2128 | revolution 2129 | revolutionary 2130 | reward 2131 | rhetoric 2132 | rhythm 2133 | ribbon 2134 | ridiculous 2135 | ritual 2136 | rocket 2137 | rolling 2138 | romance 2139 | romantic 2140 | roughly 2141 | routine 2142 | routinely 2143 | rubber 2144 | ruling 2145 | runner 2146 | running 2147 | sacred 2148 | sacrifice 2149 | safely 2150 | safety 2151 | salary 2152 | salmon 2153 | sample 2154 | sanction 2155 | sandwich 2156 | satellite 2157 | satisfaction 2158 | satisfy 2159 | saving 2160 | scandal 2161 | scared 2162 | scatter 2163 | scenario 2164 | schedule 2165 | scheme 2166 | scholar 2167 | scholarship 2168 | school 2169 | science 2170 | scientific 2171 | scientist 2172 | scramble 2173 | scratch 2174 | scream 2175 | screen 2176 | screening 2177 | script 2178 | sculpture 2179 | search 2180 | season 2181 | second 2182 | secondary 2183 | secret 2184 | secretary 2185 | section 2186 | sector 2187 | secular 2188 | secure 2189 | security 2190 | seemingly 2191 | segment 2192 | seldom 2193 | select 2194 | selected 2195 | selection 2196 | seller 2197 | seminar 2198 | senator 2199 | senior 2200 | sensation 2201 | sensitive 2202 | sensitivity 2203 | sensor 2204 | sentence 2205 | sentiment 2206 | separate 2207 | separation 2208 | sequence 2209 | series 2210 | serious 2211 | seriously 2212 | servant 2213 | service 2214 | serving 2215 | session 2216 | setting 2217 | settle 2218 | settlement 2219 | seventh 2220 | several 2221 | severe 2222 | severely 2223 | sexual 2224 | sexuality 2225 | sexually 2226 | shadow 2227 | shallow 2228 | shared 2229 | shareholder 2230 | sharply 2231 | shelter 2232 | shooting 2233 | shopping 2234 | shortage 2235 | shortly 2236 | shorts 2237 | should 2238 | shoulder 2239 | shower 2240 | shrimp 2241 | shrink 2242 | shuttle 2243 | sibling 2244 | sidewalk 2245 | signal 2246 | signature 2247 | significance 2248 | significant 2249 | significantly 2250 | silence 2251 | silent 2252 | silver 2253 | similar 2254 | similarity 2255 | similarly 2256 | simple 2257 | simply 2258 | simultaneously 2259 | singer 2260 | single 2261 | sister 2262 | situation 2263 | skilled 2264 | slavery 2265 | sleeve 2266 | slight 2267 | slightly 2268 | slowly 2269 | smooth 2270 | soccer 2271 | social 2272 | socially 2273 | society 2274 | sodium 2275 | soften 2276 | softly 2277 | software 2278 | soldier 2279 | solely 2280 | solution 2281 | somebody 2282 | someday 2283 | somehow 2284 | someone 2285 | something 2286 | sometime 2287 | sometimes 2288 | somewhat 2289 | somewhere 2290 | sophisticated 2291 | source 2292 | southeast 2293 | southern 2294 | southwest 2295 | sovereignty 2296 | speaker 2297 | special 2298 | specialist 2299 | specialize 2300 | specialty 2301 | species 2302 | specific 2303 | specifically 2304 | specify 2305 | spectacular 2306 | spectrum 2307 | speculate 2308 | speculation 2309 | speech 2310 | spending 2311 | sphere 2312 | spirit 2313 | spiritual 2314 | spokesman 2315 | sponsor 2316 | spouse 2317 | spread 2318 | spring 2319 | sprinkle 2320 | square 2321 | squeeze 2322 | stability 2323 | stable 2324 | stadium 2325 | stance 2326 | standard 2327 | standing 2328 | starter 2329 | starting 2330 | statement 2331 | station 2332 | statistical 2333 | statistics 2334 | statue 2335 | status 2336 | statute 2337 | steadily 2338 | steady 2339 | stereotype 2340 | stimulate 2341 | stimulus 2342 | stomach 2343 | storage 2344 | straight 2345 | straighten 2346 | strain 2347 | strange 2348 | stranger 2349 | strategic 2350 | strategy 2351 | streak 2352 | stream 2353 | street 2354 | strength 2355 | strengthen 2356 | stress 2357 | stretch 2358 | strict 2359 | strictly 2360 | strike 2361 | striking 2362 | string 2363 | stroke 2364 | strong 2365 | strongly 2366 | structural 2367 | structure 2368 | struggle 2369 | student 2370 | studio 2371 | stumble 2372 | stupid 2373 | subject 2374 | submit 2375 | subsequent 2376 | subsidy 2377 | substance 2378 | substantial 2379 | substantially 2380 | subtle 2381 | suburb 2382 | suburban 2383 | succeed 2384 | success 2385 | successful 2386 | successfully 2387 | sudden 2388 | suddenly 2389 | suffer 2390 | suffering 2391 | sufficient 2392 | suggest 2393 | suggestion 2394 | suicide 2395 | suitable 2396 | summary 2397 | summer 2398 | summit 2399 | sunlight 2400 | superior 2401 | supermarket 2402 | supervisor 2403 | supplier 2404 | supply 2405 | support 2406 | supporter 2407 | supportive 2408 | suppose 2409 | supposed 2410 | supposedly 2411 | surely 2412 | surface 2413 | surgeon 2414 | surgery 2415 | surprise 2416 | surprised 2417 | surprising 2418 | surprisingly 2419 | surround 2420 | surrounding 2421 | surveillance 2422 | survey 2423 | survival 2424 | survive 2425 | survivor 2426 | suspect 2427 | suspend 2428 | suspicion 2429 | suspicious 2430 | sustain 2431 | sustainable 2432 | swallow 2433 | sweater 2434 | swimming 2435 | switch 2436 | symbol 2437 | symbolic 2438 | sympathy 2439 | symptom 2440 | syndrome 2441 | system 2442 | tablespoon 2443 | tackle 2444 | tactic 2445 | talent 2446 | talented 2447 | target 2448 | taxpayer 2449 | teacher 2450 | teaching 2451 | teammate 2452 | teaspoon 2453 | technical 2454 | technician 2455 | technique 2456 | technological 2457 | technology 2458 | teenage 2459 | teenager 2460 | telephone 2461 | telescope 2462 | television 2463 | temperature 2464 | temple 2465 | temporary 2466 | tendency 2467 | tender 2468 | tennis 2469 | tension 2470 | terrain 2471 | terrible 2472 | terribly 2473 | terrific 2474 | territory 2475 | terror 2476 | terrorism 2477 | terrorist 2478 | testify 2479 | testimony 2480 | testing 2481 | textbook 2482 | texture 2483 | thanks 2484 | theater 2485 | themselves 2486 | theological 2487 | theology 2488 | theoretical 2489 | theory 2490 | therapist 2491 | therapy 2492 | thereby 2493 | therefore 2494 | thinking 2495 | thirty 2496 | thoroughly 2497 | though 2498 | thought 2499 | thousand 2500 | thread 2501 | threat 2502 | threaten 2503 | threshold 2504 | thrive 2505 | throat 2506 | through 2507 | throughout 2508 | ticket 2509 | tighten 2510 | tightly 2511 | timber 2512 | timing 2513 | tissue 2514 | tobacco 2515 | together 2516 | toilet 2517 | tolerance 2518 | tolerate 2519 | tomato 2520 | tomorrow 2521 | tongue 2522 | tonight 2523 | totally 2524 | touchdown 2525 | tourism 2526 | tourist 2527 | tournament 2528 | toward 2529 | towards 2530 | trading 2531 | tradition 2532 | traditional 2533 | traditionally 2534 | traffic 2535 | tragedy 2536 | tragic 2537 | trailer 2538 | trainer 2539 | training 2540 | transaction 2541 | transfer 2542 | transform 2543 | transformation 2544 | transit 2545 | transition 2546 | translate 2547 | translation 2548 | transmission 2549 | transmit 2550 | transport 2551 | transportation 2552 | trauma 2553 | travel 2554 | traveler 2555 | treasure 2556 | treatment 2557 | treaty 2558 | tremendous 2559 | tribal 2560 | trigger 2561 | triumph 2562 | tropical 2563 | trouble 2564 | troubled 2565 | tunnel 2566 | turkey 2567 | twelve 2568 | twentieth 2569 | twenty 2570 | typical 2571 | typically 2572 | ultimate 2573 | ultimately 2574 | unable 2575 | uncertain 2576 | uncertainty 2577 | uncomfortable 2578 | uncover 2579 | undergo 2580 | undergraduate 2581 | underlying 2582 | undermine 2583 | understand 2584 | understanding 2585 | undertake 2586 | unemployment 2587 | unexpected 2588 | unfair 2589 | unfold 2590 | unfortunately 2591 | unhappy 2592 | uniform 2593 | unique 2594 | universal 2595 | universe 2596 | university 2597 | unknown 2598 | unless 2599 | unlike 2600 | unlikely 2601 | unprecedented 2602 | unusual 2603 | update 2604 | upstairs 2605 | useful 2606 | usually 2607 | utility 2608 | utilize 2609 | vacation 2610 | vaccine 2611 | vacuum 2612 | validity 2613 | valley 2614 | valuable 2615 | vanish 2616 | variable 2617 | variation 2618 | variety 2619 | various 2620 | vegetable 2621 | vehicle 2622 | vendor 2623 | venture 2624 | verbal 2625 | verdict 2626 | version 2627 | versus 2628 | vertical 2629 | vessel 2630 | veteran 2631 | victim 2632 | victory 2633 | viewer 2634 | village 2635 | violate 2636 | violation 2637 | violence 2638 | violent 2639 | virtual 2640 | virtually 2641 | virtue 2642 | visible 2643 | vision 2644 | visitor 2645 | visual 2646 | vitamin 2647 | volume 2648 | voluntary 2649 | volunteer 2650 | voting 2651 | vulnerable 2652 | walking 2653 | wander 2654 | warehouse 2655 | warmth 2656 | warning 2657 | warrior 2658 | weaken 2659 | weakness 2660 | wealth 2661 | wealthy 2662 | weapon 2663 | weather 2664 | wedding 2665 | weekend 2666 | weekly 2667 | weight 2668 | welcome 2669 | welfare 2670 | western 2671 | whatever 2672 | wheelchair 2673 | whenever 2674 | whereas 2675 | wherever 2676 | whether 2677 | whisper 2678 | whoever 2679 | widely 2680 | widespread 2681 | wilderness 2682 | wildlife 2683 | willing 2684 | willingness 2685 | window 2686 | winner 2687 | winter 2688 | wisdom 2689 | withdraw 2690 | withdrawal 2691 | within 2692 | without 2693 | witness 2694 | wonder 2695 | wonderful 2696 | wooden 2697 | worker 2698 | working 2699 | workout 2700 | workplace 2701 | workshop 2702 | worldwide 2703 | worried 2704 | writer 2705 | writing 2706 | written 2707 | yellow 2708 | yesterday 2709 | youngster 2710 | yourself -------------------------------------------------------------------------------- /hangman/Rust/src/main.rs: -------------------------------------------------------------------------------- 1 | extern crate rand; 2 | 3 | use rand::Rng; 4 | use std::fs::File; 5 | use std::io::{BufRead, BufReader, Result}; 6 | use std::collections::HashMap; 7 | use std::io; 8 | 9 | fn main() -> Result<()> { 10 | let file = File::open("resources/words.in")?; 11 | let mut word_map = HashMap::new(); 12 | for line in BufReader::new(file).lines() { 13 | let word = line?; 14 | let list = word_map.entry(word.len() as u32).or_insert(Vec::new()); 15 | list.push(word); 16 | } 17 | 18 | let mut letter_count = String::new(); 19 | println!("Number of letters in the word?"); 20 | io::stdin().read_line(&mut letter_count) 21 | .expect("Failed to read line"); 22 | let letter_count: u32 = match letter_count.trim().parse() { 23 | Ok(num) => num, 24 | Err(_) => panic!("Must be a positive integer!") 25 | }; 26 | 27 | let words: &Vec = match word_map.get(&letter_count) { 28 | Some(list) => list, 29 | None => panic!("Sorry, no words like that.") 30 | }; 31 | 32 | let word = rand::thread_rng().choose(&words).unwrap(); 33 | let mut v = vec![false; letter_count as usize]; 34 | let mut e: u32 = 0; 35 | let mut done = true; 36 | 37 | while e < 10 { 38 | done = true; 39 | for (i, _ch) in word.chars().enumerate() { 40 | if !v[i] { 41 | done = false; 42 | } 43 | } 44 | 45 | if done { 46 | break; 47 | } 48 | 49 | let mut hit = false; 50 | let mut guess = String::new(); 51 | 52 | println!("Guess a letter: "); 53 | io::stdin().read_line(&mut guess) 54 | .expect("Failed to read line"); 55 | let guess: char = match guess.trim().parse() { 56 | Ok(ch) => ch, 57 | Err(_) => continue 58 | }; 59 | 60 | // TODO: check if previously entered. 61 | 62 | for (i, ch) in word.chars().enumerate() { 63 | if guess == ch { 64 | hit = true; 65 | v[i] = true; 66 | } 67 | } 68 | 69 | if hit { 70 | println!("Hit!"); 71 | } else { 72 | println!("Missed, mistake {} out of {}", e + 1, 10); 73 | e += 1; 74 | 75 | // drawing hangman 76 | print!("\n"); 77 | if e > 2 { 78 | println!(" xxxxxxxxxxxxx"); 79 | } else { 80 | print!("\n"); 81 | } 82 | 83 | if e > 3 { 84 | println!(" x x"); 85 | } else if e > 1 { 86 | println!(" x"); 87 | } else { 88 | print!("\n"); 89 | } 90 | 91 | if e > 3 { 92 | println!(" x x"); 93 | } else if e > 1 { 94 | println!(" x"); 95 | } else { 96 | print!("\n"); 97 | } 98 | 99 | if e > 4 { 100 | println!(" xxx x"); 101 | } else if e > 1 { 102 | println!(" x"); 103 | } else { 104 | print!("\n"); 105 | } 106 | 107 | if e > 4 { 108 | println!(" xxxxx x"); 109 | } else if e > 1 { 110 | println!(" x"); 111 | } else { 112 | print!("\n"); 113 | } 114 | 115 | if e > 4 { 116 | println!(" xxx x"); 117 | } else if e > 1 { 118 | println!(" x"); 119 | } else { 120 | print!("\n"); 121 | } 122 | 123 | if e > 5 { 124 | println!(" x x"); 125 | } else if e > 1 { 126 | println!(" x"); 127 | } else { 128 | print!("\n"); 129 | } 130 | 131 | if e > 7 { 132 | println!(" x x x x"); 133 | } else if e > 6 { 134 | println!(" x x x"); 135 | } else if e > 5 { 136 | println!(" x x"); 137 | } else if e > 1 { 138 | println!(" x"); 139 | } else { 140 | print!("\n"); 141 | } 142 | 143 | if e > 7 { 144 | println!(" x x x x"); 145 | } else if e > 6 { 146 | println!(" x x x"); 147 | } else if e > 5 { 148 | println!(" x x"); 149 | } else if e > 1 { 150 | println!(" x"); 151 | } else { 152 | print!("\n"); 153 | } 154 | 155 | if e > 5 { 156 | println!(" x x"); 157 | } else if e > 1 { 158 | println!(" x"); 159 | } else { 160 | print!("\n"); 161 | } 162 | 163 | if e > 9 { 164 | println!(" x x x"); 165 | } else if e > 8 { 166 | println!(" x x"); 167 | } else if e > 1 { 168 | println!(" x"); 169 | } else { 170 | print!("\n"); 171 | } 172 | 173 | if e > 9 { 174 | println!(" x x x"); 175 | } else if e > 8 { 176 | println!(" x x"); 177 | } else if e > 1 { 178 | println!(" x"); 179 | } else { 180 | print!("\n"); 181 | } 182 | 183 | if e > 1 { 184 | println!(" x"); 185 | } else { 186 | print!("\n"); 187 | } 188 | 189 | if e > 1 { 190 | println!(" x"); 191 | } else { 192 | print!("\n"); 193 | } 194 | 195 | if e > 0 { 196 | println!("xxxxxxxxxxxxxxxxxxxxxxxxxxxx"); 197 | } else { 198 | println!("\n"); 199 | } 200 | 201 | print!("\n"); 202 | } 203 | 204 | print!("The word: "); 205 | 206 | for (i, ch) in word.chars().enumerate() { 207 | if v[i] { 208 | print!(" {} ", ch); 209 | } else { 210 | print!(" _ "); 211 | } 212 | } 213 | print!("\n"); 214 | } 215 | 216 | if done { 217 | println!("You win!"); 218 | } else { 219 | println!("You lost."); 220 | println!("The word was: {}", word); 221 | } 222 | 223 | Ok(()) 224 | } 225 | -------------------------------------------------------------------------------- /matchsticks/C++/README.md: -------------------------------------------------------------------------------- 1 | To compile, you need g++ installed. 2 | 3 | ``` 4 | g++ matchsticks.cpp -o matchsticks 5 | ``` 6 | To run, on the command line run the command ```./matchsticks```. -------------------------------------------------------------------------------- /matchsticks/C++/matchsticks.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | 4 | bool c = true; 5 | int s = 21; 6 | 7 | void takeOrEnd(int t) { 8 | if (s - t <= 0) { 9 | cout << "game over" << endl; 10 | cout << "the winner is " + (string) (c ? "you" : "computer") << endl; 11 | s = 0; 12 | } else { 13 | s -= t; 14 | } 15 | } 16 | 17 | void printSticks() { 18 | cout << "there are " + to_string(s) + " matchstick(s) on the table" << endl; 19 | cout << string(s, '|') <> t; 45 | } while (!(t == 1 || t == 2 || t == 3)); 46 | 47 | takeOrEnd(t); 48 | c = !c; 49 | } 50 | 51 | printSticks(); 52 | } 53 | return 0; 54 | } 55 | -------------------------------------------------------------------------------- /matchsticks/C/.gitignore: -------------------------------------------------------------------------------- 1 | *.o 2 | *.exe 3 | *.out 4 | -------------------------------------------------------------------------------- /matchsticks/C/README.md: -------------------------------------------------------------------------------- 1 | To compile, you only need a C compiler installed. 2 | 3 | ## Compile with GCC 4 | 5 | ``` 6 | gcc matchsticks.cpp -o matchsticks.exe 7 | ``` 8 | To run, on the command line run the command ```./matchsticks```. 9 | -------------------------------------------------------------------------------- /matchsticks/C/matchsticks.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | int main(int argc, char ** argv) { 5 | 6 | //p - contains remaining sticks count, computer/player turn and user input (sticks taken) 7 | char * p = (char *) malloc(4*sizeof(char)); 8 | char * s = (char *) malloc(256*sizeof(char)); //user input characters 9 | 10 | *p = 0x15; 11 | *(p+1) = 1; 12 | 13 | printf("there are %d matchsticks on the table\ncomputer's first\n", *p); 14 | 15 | while (*p != 0) { 16 | if (p[1]) { 17 | printf("computer's thinking\n"); 18 | p[2] = !((*p - 1) % 4) ? 1 : (*p - 1) % 4; 19 | 20 | printf("computer takes %d\n", p[2]); 21 | // take or end 22 | if (p[1]) { // if computer 23 | if (p[0] - p[2] <= 0) { //computer takes last 24 | printf("game over\nthe winner is you\n"); 25 | p[0] = 0; 26 | } else { //computer takes 27 | p[0] = p[0] - p[2]; 28 | } 29 | } 30 | else { 31 | if (p[0] - p[2] <= 0) { //you take last 32 | p[0] = 0; 33 | printf("game over\n"); 34 | printf("the winner is computer\n"); 35 | } else { // you take 36 | p[0] -= p[2]; 37 | } 38 | } 39 | 40 | //your turn 41 | p[1] = !p[1]; 42 | 43 | } else { 44 | printf("it is your turn\n"); 45 | 46 | do { 47 | printf("you can take 1, 2 or 3!\nso how many sticks will you take?\n"); 48 | //handle invalid input 49 | scanf("%s", s); 50 | if (s[1] != '\0'){ p[2] = 0; } 51 | else { p[2] = s[0] - '0'; } 52 | } while (!(p[2] == 1 || p[2] == 2 || p[2] == 3)); 53 | 54 | // take or end 55 | if (p[1]) { // if computer 56 | if (p[0] - p[2] <= 0) { //computer takes last 57 | printf("game over\nthe winner is you\n"); 58 | p[0] = 0; 59 | } else { //computer takes 60 | p[0] = p[0] - p[2]; 61 | } 62 | } 63 | else { 64 | if (p[0] - p[2] <= 0) { //you take last 65 | p[0] = 0; 66 | printf("game over\n"); 67 | printf("the winner is computer\n"); 68 | } else { // you take 69 | p[0] -= p[2]; 70 | } 71 | } 72 | 73 | //computer turn 74 | p[1] = !p[1]; 75 | } 76 | 77 | //print sticks 78 | p[3] = *(p+3) & 0x00; 79 | printf("there are %d matchstick(s) on the table\n", *p); 80 | while ((*(p+3))++ < *p) { printf("|"); } 81 | printf("\n"); 82 | } 83 | free(p); 84 | free(s); 85 | return 0; 86 | } 87 | -------------------------------------------------------------------------------- /matchsticks/Java/README.md: -------------------------------------------------------------------------------- 1 | To compile, you need Java 7 or newer installed. 2 | 3 | The initial project contains only one source file. Compile and run: 4 | 5 | * ```javac src/main/java/floppylab/matchsticks/Matchsticks.java -d target``` 6 | * ```java -cp target floppylab.matchsticks.Matchsticks``` 7 | 8 | You can use Maven to build Jar file. Execute the following command from the matchsticks working folder: 9 | * ```mvn install``` 10 | 11 | Then execute the generated Jar: 12 | 13 | * ```java -jar matchsticks-0.0.1-SNAPSHOT.jar``` 14 | 15 | The project is a standard Eclipse Maven project. You can Import it to your Workspace: File/Import/Maven/Existing Maven Projects. 16 | -------------------------------------------------------------------------------- /matchsticks/Java/matchsticks/.gitignore: -------------------------------------------------------------------------------- 1 | HELP.md 2 | target/ 3 | !.mvn/wrapper/maven-wrapper.jar 4 | !**/src/main/** 5 | !**/src/test/** 6 | 7 | ### STS ### 8 | .apt_generated 9 | .classpath 10 | .factorypath 11 | .project 12 | .settings 13 | .springBeans 14 | .sts4-cache 15 | 16 | ### IntelliJ IDEA ### 17 | .idea 18 | *.iws 19 | *.iml 20 | *.ipr 21 | 22 | ### NetBeans ### 23 | /nbproject/private/ 24 | /nbbuild/ 25 | /dist/ 26 | /nbdist/ 27 | /.nb-gradle/ 28 | build/ 29 | 30 | ### VS Code ### 31 | .vscode/ 32 | 33 | # Compiled class file 34 | *.class 35 | 36 | # Log file 37 | *.log 38 | 39 | # BlueJ files 40 | *.ctxt 41 | 42 | # Mobile Tools for Java (J2ME) 43 | .mtj.tmp/ 44 | 45 | # Package Files # 46 | *.jar 47 | *.war 48 | *.nar 49 | *.ear 50 | *.zip 51 | *.tar.gz 52 | *.rar 53 | 54 | # virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml 55 | hs_err_pid* 56 | -------------------------------------------------------------------------------- /matchsticks/Java/matchsticks/pom.xml: -------------------------------------------------------------------------------- 1 | 3 | 4.0.0 4 | 5 | floppylab 6 | matchsticks 7 | 0.0.1-SNAPSHOT 8 | jar 9 | 10 | matchsticks 11 | http://maven.apache.org 12 | 13 | 14 | UTF-8 15 | 16 | 17 | 18 | 19 | junit 20 | junit 21 | 3.8.1 22 | test 23 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /matchsticks/Java/matchsticks/src/main/java/floppylab/matchsticks/Matchsticks.java: -------------------------------------------------------------------------------- 1 | package floppylab.matchsticks; 2 | 3 | import java.util.*; 4 | 5 | public class Matchsticks { 6 | 7 | public static void main(String[] args) { 8 | 9 | int s,t,i,c,k;s = 21; //local integer variables 10 | boolean ct = true; // local boolean variable. initial value true 11 | String str,ing = ""; //string 12 | 13 | Scanner sc = new Scanner(System.in); 14 | System.out.println("there are 21 matchsticks on the table"); 15 | System.out.println("computer's first"); 16 | 17 | while (s != 0) { 18 | if (ct) { 19 | System.out.println("computer's thinking"); 20 | k = (s - 1) % 4; 21 | if (k == 0) t = 1; else t = k; 22 | // t = (r == 0)? 1 : r; 23 | 24 | System.out.println("computer takes " + t); 25 | 26 | //take or end 27 | if (s - t <= 0) { 28 | System.out.println("game over"); 29 | if (ct == true) str = "you"; else str = "computer"; 30 | System.out.println("the winner is " + str); 31 | s = 0; 32 | } else { 33 | s -= t; 34 | } 35 | 36 | ct = !ct; 37 | 38 | } else { 39 | System.out.println("it is your turn"); 40 | 41 | do { 42 | System.out.println("you can take 1, 2 or 3!"); 43 | System.out.println("so how many sticks will you take?"); 44 | t = sc.nextInt(); 45 | } while (!(t == 1 || t == 2 || t == 3)); 46 | 47 | //take or end 48 | if (s - t <= 0) { 49 | System.out.println("game over"); 50 | System.out.println("the winner is " + ((ct) ? "you" : "computer")); 51 | s = 0; 52 | } else { s -= t; } 53 | 54 | ct = !ct; //negate variable 55 | } 56 | // print sticks 57 | System.out.println("there are "+s+" matchstick(s) on the table"); 58 | i = 0; 59 | while (i++ 4 | 5 | 6 | 7 | 13 | 14 | ``` 15 | 16 | Then to run, open a modern broswer such as Firefox, Chome, or Edge, then open the devleoper tools and switch to the console. Once you have that, drag the html file onto the broswer and look for the output in the console and watch for prompts for input. 17 | -------------------------------------------------------------------------------- /matchsticks/JavaScript/matchsticks.js: -------------------------------------------------------------------------------- 1 | var c = true 2 | var s = 21 3 | 4 | function main(args) { 5 | 6 | console.log("there are 21 matchsticks on the table"); 7 | console.log("computer's first"); 8 | 9 | while (s != 0) { 10 | if (c) { 11 | console.log("computer's thinking") 12 | var r = (s - 1) % 4 13 | var t = (r == 0) ? 1 : r 14 | 15 | console.log("computer takes $t") 16 | takeOrEnd(t) 17 | c = !c 18 | 19 | } else { 20 | console.log("it is your turn") 21 | var t 22 | 23 | do { 24 | console.log("you can take 1, 2 or 3!") 25 | t = prompt("so how many sticks will you take?") 26 | } while (!(t == 1 || t == 2 || t == 3)) 27 | 28 | takeOrEnd(t) 29 | c = !c 30 | } 31 | 32 | printSticks() 33 | } 34 | } 35 | 36 | function takeOrEnd(t) { 37 | if (s - t <= 0) { 38 | console.log("game over") 39 | console.log("the winner is " + ( (c) ? "you" : "computer")) 40 | s = 0 41 | } else { 42 | s -= t 43 | } 44 | } 45 | 46 | function printSticks() { 47 | console.log(`there are ${s} matchstick(s) on the table`) 48 | console.log("|".repeat(s)) 49 | } -------------------------------------------------------------------------------- /matchsticks/Kotlin/README.md: -------------------------------------------------------------------------------- 1 | To compile, you need Kotlin installed. 2 | 3 | * ```kotlinc matchsticks.kt -include-runtime -d matchsticks.jar``` 4 | 5 | To run, on the command line run the command ```java -jar matchsticks.jar```. 6 | -------------------------------------------------------------------------------- /matchsticks/Kotlin/matchsticks.kt: -------------------------------------------------------------------------------- 1 | package floppylab.matchsticks 2 | 3 | var c : Boolean = true 4 | var s: Int = 21 5 | 6 | fun main(args: Array) { 7 | 8 | println("there are 21 matchsticks on the table") 9 | println("computer's first") 10 | 11 | while (s != 0) { 12 | if (c) { 13 | println("computer's thinking") 14 | var r = (s - 1) % 4 15 | var t = if (r == 0) 1 else r 16 | 17 | println("computer takes $t") 18 | takeOrEnd(t) 19 | c = !c 20 | 21 | } else { 22 | println("it is your turn") 23 | var t : Int 24 | 25 | do { 26 | println("you can take 1, 2 or 3!") 27 | println("so how many sticks will you take?") 28 | t = readLine()!!.toInt() 29 | } while (!(t == 1 || t == 2 || t == 3)) 30 | 31 | takeOrEnd(t) 32 | c = !c 33 | } 34 | 35 | printSticks() 36 | } 37 | } 38 | 39 | fun takeOrEnd(t : Int) { 40 | if (s - t <= 0) { 41 | println("game over") 42 | println("the winner is " + (if (c) "you" else "computer")) 43 | s = 0 44 | } else { 45 | s -= t 46 | } 47 | } 48 | 49 | fun printSticks() { 50 | println("there are $s matchstick(s) on the table") 51 | println("|".repeat(s)) 52 | } 53 | -------------------------------------------------------------------------------- /matchsticks/README.md: -------------------------------------------------------------------------------- 1 | # Matchsticks 2 | 3 | A very simple command line game. The original code is not too long but it is buggy, unreadable and it is not easy to add a new feature. Simply said, it is a piece of legacy code you can improve your refactoring skills with. 4 | 5 | You can find the rules in the original article (check resources!) 6 | 7 | ## Steps to complete 8 | 9 | Each step should fit in 45-60 minutes. 10 | 11 | - Get to know the code, run it a few times, write some end-to-end tests 12 | - Try to make modules, extract methods, classes from the code 13 | - Write unit tests 14 | - Rethink style, rename variables, change used data structures 15 | - Refactor matchsticks drawing and communication with user, deal with error messages 16 | 17 | ## Languages 18 | 19 | - [C++](C++) 20 | - [Java](Java) 21 | - [JavaScript](JavaScript) 22 | - [Kotlin](Kotlin) 23 | 24 | ## Contributions 25 | 26 | Feel free to add a new language to the list. Please try to keep the original mistakes, structure, so that everyone can work on the "exact same" bugs, making similar improvements. 27 | 28 | Don't forget to modify this README file and please add another README to the new folder. It should contain information on the tools needed and the steps how to run the code. 29 | 30 | ## Resources 31 | 32 | - original idea comes from [Coding Interview: The Matchstick Game](https://dev.to/nestedsoftware/coding-interview-the-matchstick-game-43a8) 33 | --------------------------------------------------------------------------------