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

Added quit command and CI #26

Closed
wants to merge 9 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions .github/workflows/c-cpp.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
name: C/C++ CI

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

jobs:
build:

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- name: Compile C++ 2-17
run: make

20 changes: 20 additions & 0 deletions .github/workflows/makefile.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
name: Makefile CI

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

jobs:
build:

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2

- name: Compile C++ 2-17
run: make


8 changes: 7 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,10 @@ 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!

[![C/C++ CI](https://github.com/Alexcyfy/Wordler/actions/workflows/c-cpp.yml/badge.svg)](https://github.com/Alexcyfy/Wordler/actions/workflows/c-cpp.yml)

```
The player can also type quit during the guessing stage to quit the game.
```
8 changes: 7 additions & 1 deletion main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,16 @@ int main(){
// REVEAL ANSWER: std::cout << secret << std::endl;
std::cout << "Welcome to Wordler -- a game that totally isn't simplified Wordle\n";
std::cout << "Guess your five-letter word:\n_____\n";
std::cout << "Type quit if you want to quit the game!\n";

do{
do{
std::cin >> guess;
if(guess == "quit")
{
std::cout<<"Thanks for playing!\n";
exit(0);
}
}while( guess.length() != 5 );

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