I learned out to program in Basic from a book in the late 70's. The last computer science class I took was in 1981. The last book I read on programing was a book on HTML in the mid 2000's. So I do not know coding. What I do know is a basic understanding of what a web page can do, knowledge of flow charts, and how to write clear and concise rules. That is enough to use ai to code. I tell it what to do and then check to see if it works. Along the way I've learned a little about how backend servers work but was only able to get them set up with the help of a second ai program. The take away from this is that if I can do this, pretty much anyone can. 

This page is about the prompts that I gave Claude Sonet ai to write each game. By reading them you can see in plain language how the games work. 


First the Round Robin Game.


I want you to code a web page text based game using HTML and Javascript that is optimized for cell phones. It uses a backend server at Firebase. The information on the page updates in real time. 


// Your web app's Firebase configuration


const firebaseConfig = {


  apiKey: "AIzaSyA92SdKNL-GGZpyMtE768X_iUm0B0Hk6p0",


  authDomain: "round-robin-game.firebaseapp.com",


  projectId: "round-robin-game",


  storageBucket: "round-robin-game.firebasestorage.app",


  messagingSenderId: "635912071680",


  appId: "1:635912071680:web:55f424bc828cfd327dc6e5"


};


The data base uses a table called “game_state”. This has columns called “old_games”, “game_log”, “current_argument”, “action_one”, “result_one”, “reason_one”, “reason_two”, “reason_three”, “player_counter”, “player_comments”, “referee_comments” “argument_strength”

“Player_1”, “player_2”, “player_3”, “Player_4”, “player_5”, “player_6”, “player_7”, “player_8”


The web page consists of text blocks and buttons.


A Text block that shows 500 characters before scrolling with a scrolling bar called “Game Log”. The text in “game_log” is displayed here. 

A text block called “Who goes next?” that is followed by the text “Player number:” and the number from “player_counter”.

Below that put in a button called “Click here to make your argument.”

Below that put in a button called “Pass your turn.”

Below that put in a line of text “The current argument.”

Below that put in a text block called “Action”. This displays the text in “action_one”.

Below that put in a text block called “Result”. This displays the text in “result_one”.

Below that put in a text block called “First Reason”. This displays the text in “reason_one”.

Below that put in a text block called “Second Reason”. This displays the text in “reason_two”.

Below that put in a text block called “Third Reason”. This displays the text in “reason_three”.

Below that put in a button called “Referee Judgement”

Below that put in a button called “Make a player comment.”

Below that put in a text block called “Player Comments”. This displays the text in “player_comments”.

Below that put in a text block called “Referee Comments”. This displays the text in “referee_comments”.

Below that put in a key called “Start a New Game.”

Below that put in a text block called “Old Games”. This displays the text from “old_games”.

Below that put in a button called “Join the game as a player”.

Below that put in a button called “Leave the game”.


When someone clicks “Start a New Game”, Copy the text in “action_one” and paste it into “game_log”. Then erase the text in “action_one”. Then  copy the text in “result_one” and paste it into “game_log”. Then erase the text in “result_one”.  Then copy the text in “reason_one” and paste it into “game_log”. Then erase the text in “reason_one”. Then copy the text in “reason_two” and paste it into “game_log”. Then erase the text in “reason_two”. Then copy the text in “reason_three” and paste it into “game_log”. Then erase the text in “reason_three”. 

Then copy the text in “game_log” and paste it into “old_games” below any text that is already there. Then erase the text in “game_log”. Then make a pop up window appear that has a text block that is up to 500 characters called “Title Scenario”. Players type in this. Below that put in a button called “Cancel” that makes the pop up window disappear. Below that is a button called “Submit New Game”. When “Submit New Game” is clicked, copy the text in “Title Scenario” and paste it into “game log”. Then erase the text in “Title Scenario” and make the pop up window disappear. The reset “player_counter” to one. Then erase all the text in “player_1”, “player_2”, “player_3”, “player_4”, “player_5”, “player_6”, “player_7”, “player_8”.



When someone clicks “Join the game as a player”, make a pop up window that has the text block called “Write your name here.” Below that put in a button called “Submit name”. When “Submit name” is clicked look at “player_1”, if it already has text in it skip to “player_2” and check. If it has text then skip to “player_3. Repeat this for “player_4”, “player_5”, “player_6”, “player_7”, and “player_8”. When you find a slot that does not have text, copy the text in “Write your name here.” and paste it into the slot. Then erase the text in “Write your name here.” and make the pop up window disappear. If all the slots are filled then put in a pop up window that has the text “I’m sorry. The game is full.” followed by a button called “Return to the game.” When “Return to the game.” is clicked make both pop up windows disappear. 


When someone clicks “Leave the game”, make a pop up window that has the text “Which player are you?” Below it is a button called “Player One”, when it is clicked, copy the text in “player_1” and paste it into “game_log”, below the other text, followed by the text “has left the game.”  Then erase the text in “player_1”. Below it is a button called “Player Two” when it is clicked, copy the text in “player_2” and paste it into “game_log”, below the other text, followed by the text “has left the game.” Then erase the text in “player_2”. Below it is a button called “Player Three” when it is clicked, copy the text in “player_3” and paste it into “game_log”, below the other text, followed by the text “has left the game.” Then erase the text in “player_3”. Below it is a button called “Player Four” when it is clicked, copy the text in “player_4” and paste it into “game_log”, below the other text, followed by the text “has left the game.” Then erase the text in “player_4”. Below it is a button called “Player Five” when it is clicked, copy the text in “player_5” and paste it into “game_log”, below the other text, followed by the text “has left the game.” Then erase the text in “player_5”. Below it is a button called “Player Six” when it is clicked, copy the text in “player_6” and paste it into “game_log”, below the other text, followed by the text “has left the game.” Then erase the text in “player_6”. Below it is a button called “Player Seven” when it is clicked, copy the text in “player_7” and paste it into “game_log”, below the other text, followed by the text “has left the game.” Then erase the text in “player_7”. Below it is a button called “Player Eight” when it is clicked, copy the text in “player_8” and paste it into “game_log”, below the other text, followed by the text “has left the game.” Then erase the text in “player_8”. After one of the buttons is pushed make the pop up window disappear. 


When someone clicks “Click here to make your argument.”, make a pop up window with a button called “Make a stand alone argument” and a button called “Counter argue the last argument.” If someone clicks “Make a stand alone argument” make a pop up window that has the text “Write your argument for what happens next here.” Below that put in a text block of up to 100 characters called “Action: What do people do?” Players write here. Below that put in a text block of up to 100 characters called “Result: What happens because of the action?” Players write here.  Below that put in a text block of up to 60 characters called “Reason One”. Players write here. Below that put in a text block of up to 60 characters called “Reason Two”. Players write here. Below that put in a text block of up to 60 characters called “Reason Three”. Players write here. Below that put in a button called “Submit argument” when it is clicked, copy the text in “Action: What do people do?” and paste it in “action-one”. Copy the text in “Result: What happens because of the action?” and paste it into “result_one”. Copy the text in “Reason One” and copy it into “reason_one”. Copy the text in “Reason Two” and copy it into “reason_two”. Copy the text in “Reason Three” and copy it into “reason_three”. Then erase all the text in  “Action: What do people do?”, “Result: What happens because of the action?”, “Reason One”, “Reason Two”, “Reason Three”. Then make the pop up window disappear. Below the “Submit argument” button put a button called “Cancel”, when it is clicked make the pop up window disappear. 


When someone clicks “Counter argue the last argument” make a pop up window. It has a button called “Yes And”. Another button called “Yes But” and another button called “No Actually”.


When someone clicks “Yes And”, make a pop up window that has the text “The last argument happened. Say what happens next.” Below that, put in a text block of up to 100 characters called “Action: What do people do?” Players write here. Below that put in a text block of up to 100 characters called “Result: What happens because of the action?” Players write here.  Below that put in a text block of up to 60 characters called “Reason One”. Players write here. Below that put in a text block of up to 60 characters called “Reason Two”. Players write here. Below that put in a text block of up to 60 characters called “Reason Three”. Players write here. Below that put in a button called “Submit argument” when it is clicked, copy the text in “Action: What do people do?” and paste it in “action-one”. Copy the text in “Result: What happens because of the action?” and paste it into “result_one”. Copy the text in “Reason One” and copy it into “reason_one”. Copy the text in “Reason Two” and copy it into “reason_two”. Copy the text in “Reason Three” and copy it into “reason_three”. Then erase all the text in  “Action: What do people do?”, “Result: What happens because of the action?”, “Reason One”, “Reason Two”, “Reason Three”. Then make the pop up window disappear. Below the “Submit argument” button put a button called “Cancel”, when it is clicked make the pop up window disappear. 

 

When someone clicks “Yes But”, make a pop up window that has the text “The last action happens but there is a different result. What is it?” Below that put in a text block of up to 100 characters called “Action: What do people do?” Prefill this out with the text “The last action happens. The result is changed.” Below that put in a text block of up to 100 characters called “Result: What happens because of the action?” Players write here.  Below that put in a text block of up to 60 characters called “Reason One”. Players write here. Below that put in a text block of up to 60 characters called “Reason Two”. Players write here. Below that put in a text block of up to 60 characters called “Reason Three”. Players write here. Below that put in a button called “Submit argument” when it is clicked, copy the text in “Action: What do people do?” and paste it in “action-one”. Copy the text in “Result: What happens because of the action?” and paste it into “result_one”. Copy the text in “Reason One” and copy it into “reason_one”. Copy the text in “Reason Two” and copy it into “reason_two”. Copy the text in “Reason Three” and copy it into “reason_three”. Then erase all the text in  “Action: What do people do?”, “Result: What happens because of the action?”, “Reason One”, “Reason Two”, “Reason Three”. Then make the pop up window disappear. Below the “Submit argument” button put a button called “Cancel”, when it is clicked make the pop up window disappear. 


When someone clicks “No Actually”, make a pop up window that has the text “The previous argument doesn’t happen. Instead this happens.” Below that put in a text block of up to 100 characters called “Action: What do people do?” Players write here. Below that put in a text block of up to 100 characters called “Result: What happens because of the action?” Players write here.  Below that put in a text block of up to 60 characters called “Reason One”. Players write here. Below that put in a text block of up to 60 characters called “Reason Two”. Players write here. Below that put in a text block of up to 60 characters called “Reason Three”. Players write here. Below that put in a button called “Submit argument” when it is clicked, insert the text “The previous action was over written. This is what actually happened.” Then copy the text in “Action: What do people do?” and paste it in “action-one”. Copy the text in “Result: What happens because of the action?” and paste it into “result_one”. Copy the text in “Reason One” and copy it into “reason_one”. Copy the text in “Reason Two” and copy it into “reason_two”. Copy the text in “Reason Three” and copy it into “reason_three”. Then erase all the text in  “Action: What do people do?”, “Result: What happens because of the action?”, “Reason One”, “Reason Two”, “Reason Three”. Then make the pop up window disappear. Below the “Submit argument” button put a button called “Cancel”, when it is clicked make the pop up window disappear. 





When someone clicks “Pass your turn.” increase the  “player_counter” by one. 


When someone clicks “Referee Judgement” make a pop up window with a text block called “Pick a number between 1 and 100. This is the arguments percentage chance to happen.” The player writes a number here. Below that put in a button called “Submit Rating”. When “Submit Rating” is clicked, copy the number in “Pick a number between 1 and 100. This is the arguments percentage chance to happen.” and paste it in “argument_strength”.  Below “Submit Rating” is a button called “Referee Comment” when it is clicked, create a pop up window with a text block called “Explain your ruling.” Players write here. Below it is a button called “Submit Referee Comment” when it is clicked, copy the text from “Explain your ruling.” and paste it into “referee_comment”. Then erase the text in “Explain your ruling.” Then make the pop up window disappear. Below “Submit Referee Comment” put in a button called “Cancel” when it is clicked, make the pop up window disappear. Below the button called “Referee Comment” put in a button that is called “Resolve Turn” when it is pushed generate a random whole number between 1 and 100. If the number is less than or equal to the number in “argument_strength” then  Copy the text in “action_one” and paste it into “game_log”. Then erase the text in “action_one”. Then  copy the text in “result_one” and paste it into “game_log”. Then erase the text in “result_one”.  Then copy the text in “reason_one” and paste it into “game_log”. Then erase the text in “reason_one”. Then copy the text in “reason_two” and paste it into “game_log”. Then erase the text in “reason_two”. Then copy the text in “reason_three” and paste it into “game_log”. Then erase the text in “reason_three”. Then put “Argument Strength” followed by the number in “argument_strength”  in “game_log”. Then copy the text in “player_comments” and paste it into “game log”. Then copy the text in “referee_comments” and paste it into “game_log”. If the random number is over the number in “argument_strength” then add “The argument failed” to “game_log” below the text already there. Then Copy the text in “action_one” and paste it into “current_argument”. Then erase the text in “action_one”. Then  copy the text in “result_one” and paste it into “current_argument”. Then erase the text in “result_one”.  Then copy the text in “reason_one” and paste it into “current_argument”. Then erase the text in “reason_one”. Then copy the text in “reason_two” and paste it into “current_argument”. Then erase the text in “reason_two”. Then copy the text in “reason_three” and paste it into “current_argument”. Then erase the text in “reason_three”. Then draw a line through the text in “current_argument” Then copy the text in “current_argument”, including the line drawn through it, and paste it in “game_log” below the text already there. Then put “Argument Strength” followed by the number in “argument_strength”  in “game_log”. Then copy the text in “player_comments” and paste it into “game log”. Then copy the text in “referee_comments” and paste it into “game_log”.After one of the two tasks is done, add 1 to “player_counter” and make the pop up window disappear. 


When someone clicks “Make a player comment.” make a pop up window with a text block of up to 100 characters called “Write your comment here.” Players write in this block. Below this put a button called “Submit Comment” when it is clicked, copy the text in “Write your comment here.” and paste it into “player_comment”. Then erase the text in “Write your comment here.” and make the pop up window disappear. Below the “Submit Comment” button put a button called “Cancel” when it is clicked make the pop up window disappear. 



Next the Three Options Game.


I need to make a web based text game that is optimized for phones, coded in HTML and Javascript, that uses a backend server at Firebase. 


The game is played on a web page. The text updates in real time and is visible to anyone allowed to visit the site. In the future, people will have to register and log in before they can visit the page but for now anyone may visit it. 


The game uses a database at Firebase. Here is the log in information to put in the code.


    <script type="module">

// For Firebase JS SDK v7.20.0 and later, measurementId is optional

const firebaseConfig = {

  apiKey: "AIzaSyBt-a_veb_XSzHA1ffl9MHjBuJfH3AItIY",

  authDomain: "three-option-game.firebaseapp.com",

  databaseURL: "https://three-option-game-default-rtdb.firebaseio.com",

  projectId: "three-option-game",

  storageBucket: "three-option-game.firebasestorage.app",

  messagingSenderId: "282784686881",

  appId: "1:282784686881:web:4d92a6fe06ffc2543ed460",

  measurementId: "G-G2WH1ZCK4H"


};



Set up a database table called “Game_state”


The table includes the following columns: Turn_counter, Game_event, Option_A, Alikes_count, Adislikes_count, A_rating, A_comments, A_admin, Option_B, Blikes_count, Bdislikes_count, B_rating, B_comments, B_admin, Option_C, Clikes_count, Cdislikes_count, C_rating, C_comments, C_admin, New_game


The web page consists of the following text blocks and buttons.


“Game Events” text block, this displays the contents of the “Game_event” column of the database

“Make a move” button

“Option A” text block, this displays the contents of the “Option_A” column of the database 

Under it is a thumbs up button, a thumbs down button, a “Rating” text block of up to 6 characters, a “Comments” button, and an “Admin” button.

“Option B” text block, this displays the contents of the “Option_B” column of the database

Under it is a thumbs up button, a thumbs down button, a “Rating” text block of 7 characters, a “Comments” button, and an “Admin” button.

“Option C” text block, this displays the contents of the “Option_C” column of the database 

Under it is a thumbs up button, a thumbs down button, a “Rating” text block of 7 characters, a “Comments” button, and an “Admin” button.

“New Admin” button

“Resolve Turn” button


The game allows players to add text to “Make a move”, “Comments” and to click thumbs up and thumbs down. One player is the referee/administrator. They get to click the “Admin” button to rate moves write their own “Comments”, and click “Resolve turn” to end a turn. 


The game is played in a series of turns that are tracked by the “Turn_counter”.


The referee starts the game by clicking the “New Admin” button. This makes a text block called “Title Scenario Problem” pop up. The referee types the scenario here. Below it is a button called “Start New Game”. When it is clicked make all the text in the “Title Scenario Problem” bold. The copy and paste it into the  “Game_events” column of the database. Then the text in “Title Scenario Problem” is erased and the widow goes away. 


When a player clicks the “Make a move” button it makes a text block of up to 200 characters called “Move” appear. Players type their move here. Below it is a button called “Submit move”. When “Submit move” is clicked, copy the text in the “Move” text block and copy it into “Option_A” column, if that is already filled for this turn then copy it to the “Option_B” column, if that  is already filled then copy it into the “Option_C” column. After the text is copied to one of the Option columns, erase all the text in “Move” and make the pop up window disappear. If all three options are filled then erase the text in the “Move” text block and then put in “The options are already filled. Try again next turn.” After that has been there for 5 seconds, erase all text in “Move” and make the pop up window disappear.


Once text is copied into “Option_A”, “Option_B” and “Option_C” columns in the database they are updated in real time into the text blocks, “Option A”, “Option B” and “Option C” so that everyone can see them. Players may then click the buttons underneath each option. These buttons are thumbs up, thumbs down, and “Comment”.


When the thumbs up button under “Option A” is clicked, increase the count in the “Alike_counter” column by one. When the thumbs down button under “Option A” is clicked, increase the “Adislike_counter” column by one. When the “Comment” button is clicked make a pop up text block of up to 100 characters called “Comment A” appear. Player type in comments here. Below it is a button called “Submit comment”. When “Submit comment” is clicked, make the text in the “Comment A” text block italic and copy the text in “Comment A” and paste it into the “Option_A” column, underneath the text already there. This updates into the text block “Option A”. Then erase the text in “Comment A” and make the pop up window disappear. 


When the thumbs up button under “Option B” is clicked, increase the count in the “Blike_counter” column by one. When the thumbs down button under “Option B” is clicked, increase the “Bdislike_counter” column by one. When the “Comment” button is clicked make a pop up text block of up to 100 characters called “Comment B” appear. Player type in comments here. Below it is a button called “Submit comment”. When “Submit comment” is clicked, make the text in the “Comment B” text block italic and copy the text in “Comment B” and paste it into the “Option_B” column, underneath the text already there. This updates into the text block “Option B”. Then erase the text in “Comment B” and make the pop up window disappear. 


When the thumbs up button under “Option C” is clicked, increase the count in the “Clike_counter” column by one. When the thumbs down button under “Option C” is clicked, increase the “Cdislike_counter” column by one. When the “Comment” button is clicked make a pop up text block of up to 100 characters called “Comment C” appear. Player type in comments here. Below it is a button called “Submit comment”. When “Submit comment” is clicked, make the text in the “Comment C” text block italic and copy the text in “Comment C” and paste it into the “Option_C” column, underneath the text already there. This updates into the text block “Option C”. Then erase the text in “Comment C” and make the pop up window disappear. 


When the referee clicks the “Admin” button under the “Option A” text block, make a pop up window appear with a button called “Strong”. If it is clicked then put the word “Strong” into the “A_rating” column. Make a button called “Weak”. If it is clicked, put the word “Weak” into the “A_rating” column. Under that  include a text block of up to 200 characters called “Referee Comment”. The referee types in here. Below it put a button called “Submit Referee Comment”. When it is clicked, make the text in “Referee Comment” red and copy the text in “Referee Comment” and paste it into the “Option_A” column. Then the text in “Referee Comment” is erased. Below that put a button called “Return to the other options”. When it is clicked, the pop up window disappears.


When the referee clicks the “Admin” button under the “Option B” text block, make a pop up window appear with a button called “Strong”. If it is clicked then put the word “Strong” into the “B_rating” column of the database. Make a button called “Weak”. If it is clicked, put the word “Weak” into the “B_rating” column. Below that include a text block of up to 200 characters called “Referee Comment”. The referee types in here. Below it put a button called “Submit Referee Comment”. When it is clicked, make the text in “Referee Comment” red and copy the text in “Referee Comment” and paste it into the “Option_B” column. Then the text in “Referee Comment” is erased. Below that put a button called “Return to the other options”. When it is clicked, the pop up window disappears.


When the referee clicks the “Admin” button under the “Option C” text block, make a pop up window appear with a button called “Strong”. If it is clicked then put the word “Strong” into the “C_rating” column. Make a button called “Weak”. If it is clicked, put the word “Weak” into the “C_rating” column.  Below that include a text block of up to 200 characters called “Referee Comment”. The referee types in here. Below it put a button called “Submit Referee Comment”. When it is clicked, make the text in “Referee Comment” red and copy the text in “Referee Comment” and paste it into the “Option_C” column. Then the text in “Referee Comment” is erased. Below that put a button called “Return to the other options”. When it is clicked, the pop up window disappears.


When the “Resolve Turn” button is clicked, create a pop up window with a text box called “Has the referee marked the strongest option and the weakest option?” Below that is a “Yes” button and a “No” button. 


If the “No” button is clicked, the pop up window disappears.


If the “Yes” button is clicked, generate a whole number between 1-10.


If the number is between 1-6, look at “A_rating” if it has the word “Strong” then add “This move won.” below the text in “Option_A”. If not then look at “B_rating” if it has the word “Strong”then add “This move won.” below the text in “Option_B”. If not then look at “C_rating” if it has the word “Strong” then add “This move won.” below the text in “Option_C”.


If the number is 7-9  look at “A_rating” if the column is empty then  add “This move won.” below the text in “Option_A”. If not then look at “B_rating” if the column is empty then  add “This move won.” below the text in “Option_B”. If not then look at “C_rating” if the column is empty then add “This move won.” below the text in “Option_C”.


If the number is 10  look at “A_rating” if it has the word “Weak” then add “This move won.” below the text in “Option_A”. If not then look at “B_rating” if it has the word “Weak” then add “This move won.” below the text in “Option_B”. If not then look at “C_rating” if it has the word “Weak” then add “This move won.” below the text in “Option_C”.


Then copy the text in “Option_A” retaining all bold and italic formatting and copy it to “Game_event”. Below that copy the count from “Alikes_count” followed by “Likes” and paste into “Game_event”. Below that copy the count from “Adislikes_count” followed by “Dislikes” and paste it into “Game_event”. Then below that copy the text in “Option_B” retaining all bold and italic formatting and copy it to “Game_event”. Below that copy the count from “Blikes_count” followed by “Likes” and paste into “Game_event”. Below that copy the count from “Bdislikes_count” followed by “Dislikes” and paste it into “Game_event”. Then below that copy the text in “Option_C” retaining all bold and italic formatting and copy it to “Game_event”. Below that copy the count from “Clikes_count” followed by “Likes” and paste into “Game_event”. Below that copy the count from “Cdislikes_count” followed by “Dislikes” and paste it into “Game_event”. 


Then erase all text in “Option_A”, erase all text in “Option_B” and erase all text in “Option_C”. Return the “Alikes_count” to zero. Return the “Adislikes_count” to zero. Return the “Blikes_count” to zero. Return the “Bdislikes_count” to zero. Return the “Clikes_count” to zero. Return the “Cdislikes_count” to zero.


Then the “Has the referee marked the strongest option and the weakest option?” pop up window will disappear. 


Then add one to the “Turn_counter”.


Next the Anonymous Game.


I need you to write code for a game called “Anonymous Game”. It is a text based game that uses a backend database at Firebase in a table called “game_state” 


I do not have the URL or Anon API yet


“game_state” includes columns called “old_games” “current_game” “judge_move” and “challenge_count” and “time_end_time”


The contents of “old_games” “current_game” and “judge_move” are displayed on the web page for all to see. This is updated continuously as changes are made. “challenge_count” goes up when the “Challenge” button is clicked. “”time_end_time” starts counting when the “Submit Game” button is pushed. 


The display of this game is optimized for cell phones. 


The code is all done with HTML and Javascript. 


The display on the web page starts with the title of the game “Anonymous Game”.


Below that is a text block called “Old Games”.

Below that is a text block called “Current Game”.

Below that is a text block called “Judge Move”.

Below that are a series of buttons. 

“Challenge” button is followed by the number from the “challenge_count” column.

“What happens next?” button 

“Start a new game” button


When the “Start a new game” button is pushed, make a pop up window appear that has a text block called “Title and Scenario” which is up to 500 characters. Players type in this block. Below it is a button called “Submit Game”. When this is pushed, copy the text from the “current_game” column, including bold face type and lines drawn through text, and paste it into the “old_games” column, underneath what is already there. Then erase what is in the “current_game” column. Then copy the text in the “Title and Scenario” block and paste it into the “current_game” column in bold face type. Add in “A new game has begun. What happens next?” below that in the “current game” column. Then the pop up window disappears until the “Start a new game” button is pushed again. Start the timer in the “time_end_time”. When it reaches 24 hours, add “The game has timed out. Please start a new game.” to the “current_game” column. Copy what is in the “current_game” column, including any bold face type and lines drawn through text, and add it to the “old_games” column and then erase everything in the “current_game” column. Then set the number in the “time_end_time” column back to zero.  


When a player pushes the “What happens next?” button a pop up window appears with a text block called “Say what happens next”. It is up to 200 characters. Players type into this block. Below that is a button called “Submit move”. When “Submit move” is pushed, add in the number in the “challenge_count” underneath what is in the “judge_move” column and copy whatever is in the “judge_move” column and paste it into the “current_game” column, underneath what is already there. If that content includes special characters like a line drawn through the text, that is also copied and pasted. Then erase what is in the “judge_move” column and paste what is in the “Say what happens next” text block into the “judge_move” column. Then make the “change_count” equal zero.Then the pop up window disappears until the “What happens next?” button is pushed again.  


If there is anything in the “judge_move” column, players may click the “Challenge” button. They may click it any number of times. Each time they click add one to the “challenge_count”. Then generate a whole number between 1 and 100. If the number is 10 or less then draw a line through all the text in the “judge_move” column and add beneath it “This move was successfully challenged.”


There is no text block that shows if the web page is connected to the server. People will know it is connected because the game will work. 


And last up the Social Matrix Game. Which is the one I like the most.


I want you to write code for a web page text based game called “Social Matrix Game”. Use HTML and Javascript and optimize it for cell phones. The game will use a backend server at Firebase. 


// Your web app's Firebase configuration


const firebaseConfig = {


  apiKey: "AIzaSyAw97JWLLBMpznRcYnrYpFOXNyVDQgXyAc",


  authDomain: "social-matrix-game.firebaseapp.com",


  databaseURL: "https://social-matrix-game-default-rtdb.firebaseio.com",


  projectId: "social-matrix-game",


  storageBucket: "social-matrix-game.firebasestorage.app",


  messagingSenderId: "324499539002",


  appId: "1:324499539002:web:4b519896394e5cd617a103"


};


The database uses a table called “game_state”. This includes columns called “game_log”, “judge_move”, “challenge_counter”, “game_timer”, “turn_timer”, “replace_timer”


The “challenge_counter” starts at zero.


The  web page includes a series of text blocks and buttons. On top is a text block called “Game Log”, this block will have a scrolling bar so people can look back at what has been put in it. Below that is a text block called “Judge Move”. Below that are a series of buttons: “Replace”, “Challenge”, “Comment”, "Summarize", “Make a Move”, and “Start a New Game”. “Challenge” is followed by a counter that shows how many times the button has been clicked. “Make a Move” is followed by a timer that shows what is in “turn_timer”.


“Game Log” shows the contents of “game_log” from the database. It is updated in real time. This text block includes a scrolling bar and will show 20 lines of text before the scrolling clicks in. 


“Judge Move” shows the contents of “judge_move”. It is updated in real time. This text block includes a scrolling bar and will show 20 lines of text before the scrolling clicks in. 


When “Start a New Game” is clicked, make a pop up window with a text block called “Title Scenario Problem” that is up to 500 characters. Players write text here. Below that is a button called “Submit New Game”. When “Submit New Game” is clicked, start a timer in “game_timer”. If a game was already running, reset the timer to 4 hours. When this timer reaches 4 hours insert “The game has timed out. Please start a new game.” in “game_log” below any text already there. Once the timer is started, make the text in “Title Scenario Problem” bold type face and copy and paste it, in the bold type face, into “game_log”. Then erase the text in “Title Scenario Problem” and make the pop up window disappear. 


When “Make a Move” is clicked, make a pop up window with a text block of up to 200 characters called “Write a Move”. Players write in this text block. Below that is a button called “Submit Move”, when it is clicked, copy the text in “judge_move” and paste it into “game_log” below the text that is already there. Keep any lines drawn through text as well as text colors. Then erase the text in “judge_move”. Then print the number from “challenge_counter” followed by the text “Challenges” into “game_log” below the text that is there. Then copy the text in “Write a Move” and paste it into “judge_move”. Then erase the text in “Write a Move”. When “Submit Move” is clicked, also start a timer in “turn_timer”. This timer runs for 3 minutes. If someone clicks “Make a Move” while this timer is running, make a pop up window appear that shows the text “You can’t make a new move until the timer runs out.” Below that show the contents of “turn_timer”. Below that put in a button called “Return to the game.” When it is clicked, make the window disappear. 


When “Summarize” is clicked, make a pop up window appear with a text block of up to 50 characters called “Summarize the move in fewer words.” Players write in this. Below that is a button called “Submit Summary”. When it is clicked, copy the text in “Summarize the move in fewer words.” and paste it into “judge_move” below the text already there. Make this text blue. Then erase the text in “Summarize the move in fewer words.” and make the pop up window disappear. Also include a button called “Cancel”. When “Cancel” is clicked, make the pop up window disappear. 


When “Comment” is clicked, make a pop up window appear with a text block of up to 100 characters called “Write a Comment.” Players write in this. Below that is a button called “Submit Comment”. When it is clicked, copy the text in “Write a Comment.” and paste it into “judge_move” below the text already there. Make this text green. Then erase the text in “Write a Comment.” and make the pop up window disappear. Also include a button called “Cancel”. When “Cancel” is clicked, make the pop up window disappear. 


When “Challenge” is clicked, increase “challenge_counter” by one. Then generate a random whole number between 1 and 100. If the number is between 1-10 then draw a line through the text in “judge_move” and add below that “This move was successfully challenged.” Then copy the text in “judge_move” along with any lines drawn through and text color and paste it into “game_log” under whatever text is already there. Then erase the text in “judge_move”. If the number is between 11-100 then nothing else happens. 


When “Replace” is clicked, look at “challenge_counter”, if it has a value of anything above zero, make a pop up window appear with the text “This move has already been challenged so it cannot be replaced.” Put a button below that called “Return to the game.” When it is clicked, make the pop up window disappear. 


If the “challenge_counter” is zero then make a pop up widow appear with a text block of up to 100 characters that is called “Write what happens instead.” Players write here.  Also start a timer in “replace_timer”. When the “replace_timer” reaches 1 minute then erase the text in “Write what happens instead.” and put in “You’ve run out of time.” Below “Write what happens instead.” is a button called “Submit Replacement”, when it is clicked, generate a random whole number between 1 and 2. If the number is 1 the draw a line through the text in “judge_move” and add below it “This move was successfully replaced.” Then copy the text in “judge_move” and paste it into “game_log” retaining all lines drawn through text and text colors. The erase the text in “judge_move” Then copy the text in “Write what happens instead.” and paste it into “judge_move”. Then erase the text in “Write what happens instead.” and make the pop up window disappear. If the number is 2 then draw a line through the text in “Write what happens instead.” and add below it “Someone tried unsuccessfully to replace this move.” Then copy the text in “Write what happens instead.” and paste it into “judge_move” below the text already there. Retain all lines drawn through text and any text colors. Then erase the text in “Write what happens next.” and make the pop up window disappear. 



After the fact additions


Add in another column to the database called “old_games”. This is displayed in a text block called “Old Games” that is placed below the buttons, at the bottom of the web page. 


When the “Start a New Game.” button is clicked, before doing anything else, copy the text in “game_log” and paste it in “old_games”.