Reputation: 1
So i made this project called the Hassan Doodles which is just like my own version of Google Doodles but it didn't turn out how i wanted it as it failed to run the function
Here is the code
#include <ncurses.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
void display_initial_message() {
clear();
mvprintw(25, 104, "Presenting the Hassan Doodles");
mvprintw(26, 104, "Press spacebar to continue or 'q' to quit");
refresh();
}
void display_first_program() {
clear();
mvprintw(1, 104, "My First Program");
mvprintw(25, 104, "print('Hello World')");
mvprintw(30, 104, "Like all people I had humble beginnings like this python WOW!");
refresh();
}
void display_ocean_gpt() {
clear();
mvprintw(1, 104, "My First Team Project");
mvprintw(25, 104, "OceanGPT");
mvprintw(30, 104, "So I must tell you OceanGPT is not a GPT but just a long IO program. I know :(");
refresh();
}
void display_ai_revolution() {
clear();
mvprintw(1, 104, "AI Revolution");
mvprintw(25, 104, "A Real AI");
mvprintw(30, 104, "This was when Tensorflow, Keras and Scikit Learn made me create actual AI so wow! I AM SMART ;)");
refresh();
}
void display_sklearn(){
clear();
mvprintw(1, 104, "Scikit Learn Movement");
mvprintw(25, 104, "import sklearn");
mvprintw(30, 104, "Man so this one line made a whole .py file full to the brim and scikit-learn was sick :)");
refresh();
}
int main(void) {
initscr();
noecho();
keypad(stdscr, TRUE); // Enable capturing special keys
enum {INITIAL, FIRST_PROGRAM, OCEAN_GPT, AI_REVOLUTION, SKLEARN_MOVEMENT} state = INITIAL;
int ch;
display_initial_message();
while (1) {
ch = getch();
if (ch == 'q') {
break;
} else if (ch == ' ') {
switch (state) {
case INITIAL:
display_first_program();
state = FIRST_PROGRAM;
break;
case FIRST_PROGRAM:
display_ocean_gpt();
state = OCEAN_GPT;
break;
case OCEAN_GPT:
display_ai_revolution();
state = AI_REVOLUTION;
break;
case AI_REVOLUTION:
display_initial_message();
state = INITIAL;
break;
case SKLEARN_MOVEMENT:
display_sklearn();
state = SKLEARN_MOVEMENT;
}
}
}
endwin();
return 0;
}
I made it so that it would run a function once it was there turn but it didn't do the sklearn_movement for some reason so when i press spacebar it would go back to the beginning instead of going to Sklearn_movement
Upvotes: -1
Views: 31