Difference between revisions of "Intermediate C++ Game Programming Tutorial 9"

From Chilipedia
Jump to: navigation, search
(Created page with "We create an addictive little console game that will test both your vocabulary and your deductive powers while we flex our newfound std::muscles. == Topics Covered == * Pract...")
 
 
(28 intermediate revisions by 2 users not shown)
Line 7: Line 7:
 
== Video Timestamp Index ==
 
== Video Timestamp Index ==
 
[https://youtu.be/F9oqC1nscgE Tutorial 9]
 
[https://youtu.be/F9oqC1nscgE Tutorial 9]
 +
* Intro [https://youtu.be/F9oqC1nscgE 0:00]
 +
* Werd gameplay [https://youtu.be/F9oqC1nscgE?t=32 0:32]
 +
* Start new project in VS [https://youtu.be/F9oqC1nscgE?t=2m30s 2:30]
 +
* Using <code>std::istream::getline</code> and <code>std::vector::emplace_back</code>, load words from .txt file into a vector [https://youtu.be/F9oqC1nscgE?t=4m13s 4:13]
 +
* Using the <code>std::mt19937</code> class in <code><random></code>, generate random word out of vector of words [https://youtu.be/F9oqC1nscgE?t=7m36s 7:36]
 +
* Using <code>while</code> and <code>for</code> loops, prompt the user for input with error checking [https://youtu.be/F9oqC1nscgE?t=9m03s 9:03]
 +
* Using Chili's infamous LBA (Letter Buckets Approach), create a function to calculate word score [https://youtu.be/F9oqC1nscgE?t=12m18s 12:18]
 +
* Giving it a test run [https://youtu.be/F9oqC1nscgE?t=18m37s 18:37]
 +
* Using <code>std::tolower</code> in <code><cctype></code>, improve robustness by normalizing user input to all small-caps [https://youtu.be/F9oqC1nscgE?t=19m18s 19:18]
 +
* Enjoy seeing Chili suck at his own game [https://youtu.be/F9oqC1nscgE?t=20m47s 20:47]
 +
* Homework [https://youtu.be/F9oqC1nscgE?t=23m14s 23:14]
  
 
== Source Code ==
 
== Source Code ==
[https://github.com/planetchili/Werd Werd Repo]<br />
+
[https://github.com/planetchili/Werd Werd Game Repo]<br />
  
 
== Download Materials ==
 
== Download Materials ==
 +
* [http://www-cs-faculty.stanford.edu/~knuth/sgb-words.txt Five-letter word list]
 +
* [https://raw.githubusercontent.com/first20hours/google-10000-english/master/20k.txt Common word list]
  
 
== Homework ==
 
== Homework ==
 
The homework is to modify Werd so that it uses a second word frequency list (linked above) to filter the words selected as targets so that the game doesn't make you guess rare-ass words that nobody knows.
 
The homework is to modify Werd so that it uses a second word frequency list (linked above) to filter the words selected as targets so that the game doesn't make you guess rare-ass words that nobody knows.
 +
* [https://youtu.be/WFQphxJIzPY Homework solution]
  
 
== See also ==
 
== See also ==
 
* [[Intermediate C++ Game Programming Tutorial 10|Next in series (Tutorial 10)]]
 
* [[Intermediate C++ Game Programming Tutorial 10|Next in series (Tutorial 10)]]
 
* [[Intermediate C++ Game Programming Series]]
 
* [[Intermediate C++ Game Programming Series]]

Latest revision as of 19:57, 1 September 2019

We create an addictive little console game that will test both your vocabulary and your deductive powers while we flex our newfound std::muscles.

Topics Covered

  • Practicing std::vector/string/ifstream/cin/cout
  • std::tolower()

Video Timestamp Index

Tutorial 9

  • Intro 0:00
  • Werd gameplay 0:32
  • Start new project in VS 2:30
  • Using std::istream::getline and std::vector::emplace_back, load words from .txt file into a vector 4:13
  • Using the std::mt19937 class in <random>, generate random word out of vector of words 7:36
  • Using while and for loops, prompt the user for input with error checking 9:03
  • Using Chili's infamous LBA (Letter Buckets Approach), create a function to calculate word score 12:18
  • Giving it a test run 18:37
  • Using std::tolower in <cctype>, improve robustness by normalizing user input to all small-caps 19:18
  • Enjoy seeing Chili suck at his own game 20:47
  • Homework 23:14

Source Code

Werd Game Repo

Download Materials

Homework

The homework is to modify Werd so that it uses a second word frequency list (linked above) to filter the words selected as targets so that the game doesn't make you guess rare-ass words that nobody knows.

See also