Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can now type quit to exit the game. #42

Closed
wants to merge 17 commits into from
19 changes: 19 additions & 0 deletions .github/workflows/c-cpp.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
name: C/C++ CI

on:
push:
branches: [ main ]
pull_request:
branches: [ main ]

jobs:
build:

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- name: configure
run: g++ -std=c++11 -Wfatal-errors main.cpp dictionary.cpp -o wordler
- name: make
run: make
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
[![C/C++ CI](https://github.com/lokeshkumaraguru/Wordler/actions/workflows/c-cpp.yml/badge.svg)](https://github.com/lokeshkumaraguru/Wordler/actions/workflows/c-cpp.yml)

# Wordler

This is a command line word guessing game.
Expand All @@ -16,4 +18,4 @@ Then play the game:
./wordler
```

The game will randomly-select a 5-letter word and you have unlimited guesses to get the word right. Each time you guess, if you have a letter that matches the same location as it is in the secret word, it will be revealed to you. However, any letter that does *not* match the secret word's letter at the same location will be displayed as `_`. Good luck!
The game will randomly-select a 5-letter word and you have unlimited guesses to get the word right. Each time you guess, if you have a letter that matches the same location as it is in the secret word, it will be revealed to you. However, any letter that does *not* match the secret word's letter at the same location will be displayed as `_`. Good luck!
9 changes: 8 additions & 1 deletion main.cpp
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// test comment

#include <iostream>
#include <cstdlib>
#include <ctime>
Expand All @@ -24,6 +26,11 @@ int main(){
do{
do{
std::cin >> guess;

if (guess == "quit") {
exit(0);
}

}while( guess.length() != 5 );

// capitalize guess for easy comparisons
Expand Down Expand Up @@ -54,4 +61,4 @@ std::string get_hint(std::string match, std::string word){
}
}
return word;
}
}