Skip to main content
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Go to solution

Coding help request: a simple question, answer and conditional response system

Dear All,

I have a GoDaddy Managed Wordpress site that I want to use to build a simple educational tool (a question, answer and response programme) but haven't found a plugin that can produce what I'm looking for.  I have written pseuodcode (see below) for what I want the programme to do but in summary it is a game of 10 rounds where for each round: the system generates a random number, say x, between 1 and 100 and asks the player to enter a number, y, that lies between that number and 100; the system then gives suitable feedback depending on whether the player's answer was correct; and finally the player presses a "Next" button to go on to the next question.  After the 10th round the system gives a nice closing remark!  

I can generally read and understand code, as you will see from my pseudocode, but have little experience of coding myself.  I suspect that as well as needing some sample code I would need to know where/how to enter it within my managed wordpress site.  [Apologies for being a such a novice].    My pseudocode is as follows:

//  Declare integer variables n, m, x, y

var int n,m

var int x,y

// Set counter n to 1 and score m to 0

n := 1

m:= 1

// Set up a while loop

while n <= 10

            {

             // Randomly set integer x to be a number between between 0 and 100

             x := rand(100) ;

             //  Ask the user to input an integer greater than or equal to my integer.

             //  and assign their input to variable y

             y := input(“Please enter a number between “ x “ and 100 inclusive.”);

            // Provide the appropriate feedback

             if  y > 100 then print(“Oops! Not quite: “ y “ is greater than 100”)

             else if y < x then print(“Oops! Not quite: “ y “ is less than ” x)

             else print(“Great!”);

            // Increment score m by 1 if the answer was correct

            if (y  >= x  AND y <= 100) then m := m=1;

             // Increment counter n by 1

             n := n + 1

             // User presses “Next” button when they’re ready.

             button.wait_for_press();

}

// A closing remark.

print(“Thanks for playing.  You got “ m “ correct.”);

 

Thank you so much in advance for helping me with this.  🙂

And Happy New Year 🙂

1 ACCEPTED SOLUTION
PL281
Super User IV

@christiemay 

 

Something like this would either need to be coded in a custom plugin or a template within your theme - I suggest you may want to put this up on https://codeable.io/ and you can hire someone to code this for you. 

I am a GoDaddy End User - Just Like You
Check out my site! | I currently manage over 300 WordPress Websites
* Please note that I offer free advice on this forum. Thank You Info If you would like personalized help, please contact me. Otherwise, please ask your question in the proper forum so the answer can assist EVERYONE in the community and not just you. Thanks! *

Once your issue is resolved,
please be sure to come back and click accept for the solution

Get Better Support on the Community Boards!
Etiquette When Asking for Help from the Community

View solution in original post

1 REPLY 1
PL281
Super User IV

@christiemay 

 

Something like this would either need to be coded in a custom plugin or a template within your theme - I suggest you may want to put this up on https://codeable.io/ and you can hire someone to code this for you. 

I am a GoDaddy End User - Just Like You
Check out my site! | I currently manage over 300 WordPress Websites
* Please note that I offer free advice on this forum. Thank You Info If you would like personalized help, please contact me. Otherwise, please ask your question in the proper forum so the answer can assist EVERYONE in the community and not just you. Thanks! *

Once your issue is resolved,
please be sure to come back and click accept for the solution

Get Better Support on the Community Boards!
Etiquette When Asking for Help from the Community

View solution in original post