summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorlouie <lshprung@yahoo.com>2020-09-20 09:26:58 -0700
committerlouie <lshprung@yahoo.com>2020-09-20 09:26:58 -0700
commita8c0d5619ee6d518737628d6c585233d0bba23da (patch)
tree30c13cf2439700c78d51acc9b430cb5fa092f963
First commit
-rw-r--r--1.pngbin0 -> 9523 bytes
-rw-r--r--2.pngbin0 -> 11589 bytes
-rw-r--r--3.pngbin0 -> 14184 bytes
-rw-r--r--4.pngbin0 -> 15097 bytes
-rw-r--r--5.pngbin0 -> 17218 bytes
-rw-r--r--6.pngbin0 -> 19217 bytes
-rw-r--r--8-dots-dice-clipart.pngbin0 -> 80580 bytes
-rw-r--r--debug.log1
-rw-r--r--fo.js238
-rw-r--r--free.html23
-rw-r--r--free.js223
-rw-r--r--game.html26
-rw-r--r--game.php41
-rw-r--r--instructions.html35
-rw-r--r--instructions.js127
-rw-r--r--instructions.php55
-rw-r--r--mode_select.html39
-rw-r--r--mode_select.php33
-rw-r--r--pong.html15
-rw-r--r--scripts.php299
-rw-r--r--sql_00.php45
-rw-r--r--test.html1
-rw-r--r--test.php17
-rw-r--r--test2.html8
-rw-r--r--test2.php6
-rw-r--r--yahtzee.css277
-rw-r--r--yahtzee.html34
-rw-r--r--yahtzee.php28
-rw-r--r--yahtzee_legacy.css276
29 files changed, 1847 insertions, 0 deletions
diff --git a/1.png b/1.png
new file mode 100644
index 0000000..80b2c9e
--- /dev/null
+++ b/1.png
Binary files differ
diff --git a/2.png b/2.png
new file mode 100644
index 0000000..cde64bf
--- /dev/null
+++ b/2.png
Binary files differ
diff --git a/3.png b/3.png
new file mode 100644
index 0000000..da27dd3
--- /dev/null
+++ b/3.png
Binary files differ
diff --git a/4.png b/4.png
new file mode 100644
index 0000000..b1fea0b
--- /dev/null
+++ b/4.png
Binary files differ
diff --git a/5.png b/5.png
new file mode 100644
index 0000000..c077edd
--- /dev/null
+++ b/5.png
Binary files differ
diff --git a/6.png b/6.png
new file mode 100644
index 0000000..87039a3
--- /dev/null
+++ b/6.png
Binary files differ
diff --git a/8-dots-dice-clipart.png b/8-dots-dice-clipart.png
new file mode 100644
index 0000000..ca5fac9
--- /dev/null
+++ b/8-dots-dice-clipart.png
Binary files differ
diff --git a/debug.log b/debug.log
new file mode 100644
index 0000000..e91ca22
--- /dev/null
+++ b/debug.log
@@ -0,0 +1 @@
+[0712/152143.741:ERROR:crash_report_database_win.cc(428)] unexpected header
diff --git a/fo.js b/fo.js
new file mode 100644
index 0000000..d6776ef
--- /dev/null
+++ b/fo.js
@@ -0,0 +1,238 @@
+var dice = {
+
+ scoring:[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],
+ vals:[0,0,0,0,0],
+ holds:[0,0,0,0,0],
+ roll:-1,
+ round:0,
+ fhoak:0, //for use in determining full house
+ finish:false, //will be true when the game is over
+
+ submit_round:function(){
+ dice.roll = 3;
+ },
+
+ hold_func:function(n){ //called when a dice is clicked on
+ dice.holds[n] = !dice.holds[n];
+ document.getElementById(`hold${n}`).innerHTML= (dice.holds[n]? "<div class='HOLD'>HOLD</div>":'&nbsp;')
+ },
+ rand:function(){ //picks a random dice value
+ return Math.ceil(Math.random()*6);
+ },
+
+ oak: function(num_of_kind, repeat = 0){ //determines x of a kind scoring (including yahtzee)
+ let ret = 0,
+ count;
+ for(let n = 1; n <= 6; n++){ //each possible dice value is checked
+ if(n !== repeat){
+ count = 0;
+ for(let i = 0; i < 5; i++){ //how many of this val do I have? lets look at each dice...
+ if(dice.vals[i] == n) count++;
+ }
+ }
+ if(count >= num_of_kind) {
+ dice.fhoak = n;
+ for(let i = 0; i < 5; i++){
+ ret += dice.vals[i];
+ }
+ }
+ }
+ return ret;
+ },
+
+ full_house: function(){ //determines full house scoring (using x of a kind and dice.fhoak)
+ return (dice.oak(3) ? (dice.oak(2, dice.fhoak) ? 25:0) : 0);
+ },
+
+ straight: function(size){ //determines small and large straight scoring
+ let str = '';
+ let count;
+ let p = 0;
+ for(let val in dice.vals){ // 26345
+ str += dice.vals[val];
+ }
+ for(let a = size; a <= 6; a++){ // 4 : 4,5,6
+ count = 0;
+ for(let b = 1+(a-size); b <= a; b++){
+ if(str.includes(b)){
+ count++;
+ }
+ }
+ if(count >= size){
+ p = 30+(size-4)*10;
+ break;
+ }
+ }
+ return p;
+ },
+
+ chance:function(){ //determines chance scoring
+ let sum = 0;
+ //dice.vals.forEach(x => { sum+=x});
+ for(let val in dice.vals){
+ sum += dice.vals[val];
+ }
+ return sum;
+ },
+
+ final_scoring:function(){ //called when dice.finish is set to true to determine the final score values
+ prepare_score(20, dice.scoring[8]);
+ for(let s = 9; s <= 15; s++){
+ dice.scoring[19] += dice.scoring[s];
+ }
+ dice.scoring[19] += dice.scoring[17];
+ prepare_score(21, dice.scoring[19]);
+ dice.scoring[20] = dice.scoring[8]+dice.scoring[19];
+ prepare_score(22, dice.scoring[20]);
+ dice.finish = true;
+ },
+
+ render_dice:function(dont_shuffle){ //main function called each time roll or submit is clicked on
+ //(dice.roll == -1 || dice.roll == 3 ? document.getElementById('submit').setAttribute('style', 'opacity:0') : document.getElementById('submit').setAttribute('style', 'opacity:1'));
+ document.getElementById('submit').setAttribute('style', 'opacity:'+(dice.roll == -1 || dice.roll == 3 ?'0':'1'));
+ document.getElementById('roll_display').innerText = (dice.roll == 2 ? 'Submit' : 'Roll!');
+
+ if(dice.roll == 3){
+
+ if(dice.round < 6){ //determine scores each upper round
+ for(let d = 0; d < 5; d++){
+ if(dice.vals[d] == dice.round + 1){
+ dice.scoring[dice.round] += dice.vals[d];
+ }
+ }
+ prepare_score((dice.round+2), dice.scoring[dice.round]);
+ }
+
+ if(dice.round == 5){ //determines final upper score
+ for(let d = 0; d < 6; d++){
+ dice.scoring[6] += dice.scoring[d];
+ }
+ prepare_score(8, dice.scoring[6]);
+ dice.scoring[7] = (dice.scoring[6] >= 63 ? 35 : 0);
+ prepare_score(9, dice.scoring[7]);
+ dice.scoring[8] = dice.scoring[6] + dice.scoring[7];
+ prepare_score(10, (dice.scoring[8]));
+ }
+
+ if(dice.round >= 6 && dice.round < 13){ //determines scores for each lower round
+ let calc=0;
+ switch(dice.round){
+ case 6: calc = dice.oak(3); break;
+ case 7: calc = dice.oak(4); break;
+ case 8: calc = dice.full_house(); break;
+ case 9: calc = dice.straight(4); break;
+ case 10: calc = dice.straight(5); break;
+ case 11: calc = (dice.oak(5) ? 50:0); break;
+ case 12: calc = dice.chance(); break;
+ }
+ dice.scoring[dice.round+3] = calc;
+ prepare_score((dice.round+5), dice.scoring[dice.round+3]);
+ }
+
+ if(dice.round == 12 && !dice.scoring[14]){ //if yahtzee was not met, get final scores and end the game
+ dice.final_scoring();
+ }
+
+ if(dice.round == 13){ //if yahtzee WAS met, play the yahtzee bonus round and then get final scores and end the game
+ dice.scoring[16] = (dice.oak(5) ? '&#10003' : '&#10007');
+ dice.scoring[17] = (dice.oak(5) ? 100 : 0);
+ prepare_score(18, dice.scoring[16]);
+ prepare_score(19, dice.scoring[17]);
+ dice.final_scoring();
+ }
+
+ for(let i = 0; i < 5; i++){ //reset holds at the start of each round
+ dice.holds[i] = 0;
+ }
+ }
+
+ update();
+ let out = '';
+ for(let i = 0; i < 5; i++){
+ dice.vals[i] = dice.holds[i] || dont_shuffle ? dice.vals[i] : dice.rand();
+ out +=
+ `<span class='dice_box'>
+ <button class='dice_click' onclick='dice.hold_func(${i})'>
+ <img class='dice_pics' src='${dice.vals[i]}.png' style='opacity:
+ ` + (dice.roll ? "1":"0") + `'/>
+ </button>
+ <div id='hold${i}'>` + (dice.holds[i]? "<div class='HOLD'>HOLD</div>":'&nbsp;') + `</div>
+ </span>`;
+ }
+ if(!dice.finish){ //renders the main playfield
+ document.getElementsByClassName('dice_display')[0].innerHTML = out;
+ document.getElementById('roll_count').innerHTML = "Roll " + (dice.roll ? `#${dice.roll}` : 'the dice!');
+ if(dice.round < 13) {document.getElementById('notice').innerHTML = roll_for()};
+ if(dice.round >= 13 && dice.scoring[14]) {document.getElementById('notice').innerHTML ="<h2 id='reminder'>You are rolling for: <span>Yahtzee Bonus</span></h2>"};
+ document.getElementById('roll_count').style.marginLeft = (dice.roll ? '120px' : '67.5px');
+ //console.log(dice.scoring);
+ }
+ else{ //renders the game over screen if dice.finish is true
+ document.getElementById('notice').setAttribute('style', 'display:none');
+ document.getElementsByClassName('dice_display')[0].setAttribute('style', 'display:none');
+ document.getElementById('submit_line').setAttribute('style', 'display:none');
+ document.getElementsByClassName('top_pad')[0].innerHTML =
+ `<span id='game_over'>
+ <div id='Thanks'>Thanks for Playing!</div>
+ <div id='final_score'>Your Final Score: ${dice.scoring[20]}</div>
+ <a class='end_select' id='play_again' href='game.html'>
+ Click Here to Play Again
+ </a>
+ <a class='end_select' id='go_back' href='mode_select.html'>
+ Click Here to Go Back
+ </a>
+ </span>`;
+ }
+ }
+}
+
+function make_head(header){ //creates the header
+ return `<img class='small_dice' src='${dice.rand()}.png'> ${header} <img class='small_dice' src='${dice.rand()}.png'>`;
+}
+
+function roll_for(){
+ let arr = ['Aces', 'Twos', 'Threes', 'Fours', 'Fives', 'Sixes',
+ '3 of a Kind', '4 of a Kind', 'Full House',
+ 'Small Straight', 'Large Straight', 'YAHTZEE', 'Chance'];
+ return `<h2 id='reminder'>You are rolling for: <span>${arr[dice.round]}</span></h2>`;
+}
+
+function update(){ //increments dice.roll each time in dice.render
+ if(dice.roll < 3){
+ dice.roll++
+ }
+ else {
+ dice.roll = 0;
+ dice.round++;
+ }
+}
+
+function render_scoreboard(){ //script to create the scoreboard layout
+ let round_val =
+ ['UPPER SECTION', 'Aces', 'Twos', 'Threes', 'Fours', 'Fives', 'Sixes', 'TOTAL SCORE', 'BONUS', 'TOTAL',
+ '3 of a Kind', '4 of a Kind', 'Full House', 'Small Straight', 'Large Straight', 'YAHTZEE', 'Chance',
+ 'YAHTZEE BONUS &#10003s', 'YAHTZEE BONUS scoring', 'TOTAL UPPER', 'TOTAL LOWER', 'GRAND TOTAL'];
+ let out = '';
+
+ for(let a=1; a <= 2; a++){
+ if(a == 2){
+ out += "<div id='LOWER'>LOWER SECTION</div> \n";
+ }
+ out += `<div id='score_section${a}'> \n`;
+
+ for(let i=1; i <= (8+a*2); i++){
+ out += `<div class='grid_container gc${a}' id='grid_element` + (i + (a-1)*10) + "'><span>"+
+ round_val[(i-1)+(a-1)*10] + "</span></div> \n";
+ }
+ out += '</div>';
+ }
+ return out;
+}
+
+function prepare_score(place, value){ //when called, updates a specific score
+ return document.getElementById(`grid_element${place}`).insertAdjacentHTML('beforeend', `<span class='score_val'>${value}</span>`)
+}
+
+document.getElementsByClassName('shifted_head')[0].innerHTML = make_head("Now Playing: Forced Order Mode");
+dice.render_dice();
+document.getElementById('full_scoreboard').innerHTML = render_scoreboard(); \ No newline at end of file
diff --git a/free.html b/free.html
new file mode 100644
index 0000000..9c10169
--- /dev/null
+++ b/free.html
@@ -0,0 +1,23 @@
+<html>
+ <head>
+ <title>Yahtzee</title>
+ <link rel="stylesheet" href="yahtzee.css">
+ </head>
+
+ <body>
+ <a href='mode_select.html'><span class='back'>&lt Go Back</span></a>
+ <h1 class='shifted_head'></h1> <!-- head inserted via make_head() -->
+
+ <div class='top_pad_free'></div>
+ <div class=dice_display></div> <!-- dice inserted via dice.render_dice() -->
+ <span id='submit_line'>
+ <span id='roll_count'></span> <!-- roll# inserted via js innerHTML -->
+ <button id='roll_display_free' onclick='dice.render_dice()'>Roll!</button>
+ </span>
+
+ <h2>Scoreboard</h2>
+ <div id='full_scoreboard'></div>
+ </body>
+
+ <script type="text/javascript" src="free.js"></script>
+</html> \ No newline at end of file
diff --git a/free.js b/free.js
new file mode 100644
index 0000000..a0f0bc6
--- /dev/null
+++ b/free.js
@@ -0,0 +1,223 @@
+var dice = {
+
+ // game ends when round = 13 (assuming yahtzee is not achieved)
+ scoring:[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],
+ scoring_set: [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],
+ vals:[0,0,0,0,0],
+ holds:[0,0,0,0,0],
+ roll:-1,
+ round:0,
+ fhoak:0, //for use in determining full house - keep
+ finish:false, //will be true when the game is over - keep
+
+ hold_func:function(n){ //called when a dice is clicked on - keep
+ dice.holds[n] = !dice.holds[n];
+ document.getElementById(`hold${n}`).innerHTML= (dice.holds[n]? "<div class='HOLD'>HOLD</div>":'&nbsp;')
+ },
+ rand:function(){ //picks a random dice value - keep
+ return Math.ceil(Math.random()*6);
+ },
+
+ oak: function(num_of_kind, repeat = 0){ //determines x of a kind scoring (including yahtzee) -keep
+ let ret = 0;
+ let count;
+ for(let n = 1; n <= 6; n++){ //each possible dice value is checked
+ if(n !== repeat){
+ count = 0;
+ for(let i = 0; i < 5; i++){ //how many of this val do I have? lets look at each dice...
+ if(dice.vals[i] == n) count++;
+ }
+ }
+ if(count >= num_of_kind) {
+ dice.fhoak = n;
+ for(let i = 0; i < 5; i++){
+ ret += dice.vals[i];
+ }
+ }
+ }
+ return ret;
+ },
+
+ full_house: function(){ //determines full house scoring (using x of a kind and dice.fhoak) - keep
+ return (dice.oak(3) ? (dice.oak(2, dice.fhoak) ? 25:0) : 0);
+ },
+
+ straight: function(size){ //determines small and large straight scoring - keep
+ let str = '';
+ let count;
+ let p = 0;
+ for(let val in dice.vals){
+ str += dice.vals[val];
+ }
+ for(let a = size; a <= 6; a++){
+ count = 0;
+ for(let b = 1+(a-size); b <= a; b++){
+ if(str.includes(b)){
+ count++;
+ }
+ }
+ if(count >= size){
+ p = 30+(size-4)*10;
+ break;
+ }
+ }
+ return p;
+ },
+
+ chance:function(){ //determines chance scoring - keep
+ let sum = 0;
+ for(let val in dice.vals){
+ sum += dice.vals[val];
+ }
+ return sum;
+ },
+
+ final_scoring:function(){ //called when dice.finish is set to true to determine the final score values - keep, toChange
+ for(let d = 0; d < 6; d++){
+ dice.scoring[6] += dice.scoring[d];
+ }
+
+ dice.scoring[7] = (dice.scoring[6] >= 63 ? 35 : 0);
+ dice.scoring[8] = dice.scoring[6] + dice.scoring[7];
+
+ if(dice.scoring[16] == '&#10003'){
+ dice.scoring[17] = 100;
+ }
+ if(dice.scoring[16] == '&#10007'){
+ dice.scoring[17] = 0;
+ }
+
+ dice.scoring[18] = dice.scoring[8];
+ for(let d = 9; d < 16; d++){
+ dice.scoring[19] += dice.scoring[d];
+ }
+ dice.scoring[19] += dice.scoring[17]
+ dice.scoring[20] = dice.scoring[18] + dice.scoring[19];
+
+ dice.finish = true;
+ },
+
+ score:function(element){
+ dice.roll = 3;
+
+ let calc_arr = [dice.oak(3), dice.oak(4), dice.full_house(), dice.straight(4), dice.straight(5), (dice.oak(5) ? 50:0), dice.chance(), (dice.oak(5) ? '&#10003':'&#10007')];
+
+ dice.scoring_set[element-2] = true;
+ if(element <= 7){ //determine scores each upper round
+ for(let d = 0; d < 5; d++){
+ if(dice.vals[d] == element - 1){
+ dice.scoring[element-2] += dice.vals[d];
+ }
+ }
+ }
+
+ if(element > 7){ //determines scores for each lower round
+ dice.scoring[element-2] = calc_arr[element-11];
+ }
+
+ if(dice.round == (12 + dice.scoring[14]/50)){
+ dice.final_scoring();
+ }
+
+ for(let d = 0; d < 5; d++){ //reset holds at the start of each round
+ dice.holds[d] = 0;
+ }
+ },
+
+ render_dice:function(dont_shuffle){ //main function called each time roll or submit is clicked on -keep, toChange
+
+ (dice.roll == 2 ? document.getElementById('roll_display_free').style.display = 'none' : document.getElementById('roll_display_free').style.display = 'unset');
+
+ update(); //keep
+ let out = '';
+ for(let i = 0; i < 5; i++){ //keep
+ dice.vals[i] = dice.holds[i] || dont_shuffle ? dice.vals[i] : dice.rand();
+ out +=
+ `<span class='dice_box'>
+ <button class='dice_click' onclick='dice.hold_func(${i})'>
+ <img class='dice_pics' src='${dice.vals[i]}.png' style='opacity:
+ ` + (dice.roll ? "1":"0") + `'/>
+ </button>
+ <div id='hold${i}'>` + (dice.holds[i]? "<div class='HOLD'>HOLD</div>":'&nbsp;') + `</div>
+ </span>`;
+ }
+
+ document.getElementById('full_scoreboard').innerHTML = render_scoreboard(); //keep
+
+ if(!dice.finish){ //renders the main playfield - keep
+ document.getElementsByClassName('dice_display')[0].innerHTML = out;
+ document.getElementById('roll_count').innerHTML = "Roll " + (dice.roll ? `#${dice.roll}` : 'the dice!');
+ document.getElementById('roll_count').style.marginLeft = (dice.roll ? '120px' : '67.5px');
+ //console.log(dice.scoring);
+ }
+ else{ //renders the game over screen if dice.finish is true - keep
+ document.getElementById('grid_element8').insertAdjacentHTML('beforeend', `<span class='score_val'>${dice.scoring[6]}</span>`);
+ document.getElementById('grid_element9').insertAdjacentHTML('beforeend', `<span class='score_val'>${dice.scoring[7]}</span>`);
+ document.getElementById('grid_element10').insertAdjacentHTML('beforeend', `<span class='score_val'>${dice.scoring[8]}</span>`);
+ document.getElementById('grid_element19').insertAdjacentHTML('beforeend', `<span class='score_val'>${dice.scoring[17]}</span>`);
+ document.getElementById('grid_element20').insertAdjacentHTML('beforeend', `<span class='score_val'>${dice.scoring[18]}</span>`);
+ document.getElementById('grid_element21').insertAdjacentHTML('beforeend', `<span class='score_val'>${dice.scoring[19]}</span>`);
+ document.getElementById('grid_element22').insertAdjacentHTML('beforeend', `<span class='score_val'>${dice.scoring[20]}</span>`);
+ document.getElementsByClassName('dice_display')[0].setAttribute('style', 'display:none');
+ document.getElementById('submit_line').setAttribute('style', 'display:none');
+ document.getElementsByClassName('top_pad_free')[0].innerHTML =
+ `<span id='game_over'>
+ <div id='Thanks'>Thanks for Playing!</div>
+ <div id='final_score'>Your Final Score: ${dice.scoring[20]}</div>
+ <a class='end_select' id='play_again' href='free.html'>
+ Click Here to Play Again
+ </a>
+ <a class='end_select' id='go_back' href='mode_select.html'>
+ Click Here to Go Back
+ </a>
+ </span>`;
+ }
+ }
+}
+
+function make_head(header){ //creates the header - keep
+ return `<img class='small_dice' src='${dice.rand()}.png'> ${header} <img class='small_dice' src='${dice.rand()}.png'>`;
+}
+
+function update(){ //increments dice.roll each time in dice.render - keep, toChange
+ if(dice.roll < 3){
+ dice.roll++
+ }
+ else {
+ dice.roll = 0;
+ dice.round++;
+ }
+ console.log(dice.round);
+}
+
+function render_scoreboard(){ //script to create the scoreboard layout - keep
+ let round_val =
+ ['UPPER SECTION', 'Aces', 'Twos', 'Threes', 'Fours', 'Fives', 'Sixes', 'TOTAL SCORE', 'BONUS', 'TOTAL',
+ '3 of a Kind', '4 of a Kind', 'Full House', 'Small Straight', 'Large Straight', 'YAHTZEE', 'Chance',
+ 'YAHTZEE BONUS &#10003s', 'YAHTZEE BONUS scoring', 'TOTAL UPPER', 'TOTAL LOWER', 'GRAND TOTAL'];
+ let clickables = [2,3,4,5,6,7,11,12,13,14,15,16,17];
+ if(dice.scoring[14] > 0){
+ clickables.push(18);
+ }
+ let out = '';
+
+ for(let a=1; a <= 2; a++){
+ if(a == 2){
+ out += "<div id='LOWER'>LOWER SECTION</div> \n";
+ }
+ out += `<div id='score_section${a}'> \n`;
+
+ for(let i=1; i <= (8+a*2); i++){
+ out += `<div id='grid_element${(i + (a-1)*10)}' class='grid_container gc${a} `; //onclick will trigger dice.score. The onclick should only be written to scorable sections (i.e Aces, not UPPER SECTION). dice.score will take in a value and will function similar to the dice.roll == 3 if statement
+ out += ((clickables.includes(i + (a-1)*10)) && (dice.roll !== 0) && (!dice.scoring_set[(i + (a-1)*10) - 2]) ? `clickable' onclick='dice.score(${(i + (a-1)*10)});dice.render_dice()';` : "'"); //todo: render scoreboard on every submission
+ out += `>${round_val[(i-1)+(a-1)*10]}`;
+ out += (dice.scoring_set[(i + (a-1)*10) - 2] ? `<span class='score_val'>${dice.scoring[(i + (a-1)*10) - 2]}</span>` : '') + `</div> \n`;
+ }
+ out += '</div>';
+ }
+ return out;
+}
+
+document.getElementsByClassName('shifted_head')[0].innerHTML = make_head("Now Playing: Free Mode"); //keep
+dice.render_dice(); //keep
+document.getElementById('full_scoreboard').innerHTML = render_scoreboard(); //keep \ No newline at end of file
diff --git a/game.html b/game.html
new file mode 100644
index 0000000..5a54cee
--- /dev/null
+++ b/game.html
@@ -0,0 +1,26 @@
+<html>
+ <head>
+ <title>Yahtzee</title>
+ <link rel="stylesheet" href="yahtzee.css">
+ </head>
+
+ <body>
+ <a href='mode_select.html'><span class='back'>&lt Go Back</span></a>
+ <h1 class='shifted_head'></h1> <!-- head inserted via make_head() -->
+
+ <div id='notice'></div>
+
+ <div class='top_pad'></div>
+ <div class=dice_display></div> <!-- dice inserted via dice.render_dice() -->
+ <span id='submit_line'>
+ <span id='roll_count'></span> <!-- roll# inserted via js innerHTML -->
+ <button id='roll_display' onclick='dice.render_dice()'>Roll!</button>
+ <button id='submit' onclick='dice.submit_round();dice.render_dice();'>Submit</button> <!-- functions via dice.submit_round-->
+ </span>
+
+ <h2>Scoreboard</h2>
+ <div id='full_scoreboard'></div>
+ </body>
+
+ <script type="text/javascript" src="fo.js"></script>
+</html> \ No newline at end of file
diff --git a/game.php b/game.php
new file mode 100644
index 0000000..7f4715b
--- /dev/null
+++ b/game.php
@@ -0,0 +1,41 @@
+<?php
+ include 'scripts.php';
+?>
+
+<html>
+ <head>
+ <title>Yahtzee</title>
+ <link rel="stylesheet" href="yahtzee.css">
+ </head>
+
+ <body>
+ <a href='mode_select.php'><span class='back'>&lt Go Back</span></a>
+ <h1 class='shifted_head'>
+ <?=make_head('Yahtzee')?>
+ </h1>
+
+ <?=check_end()?>
+
+ <form>
+ <div class='top_pad'></div>
+ <div class=dice_display>
+ <?=display_dice()?>
+ </div>
+ <span id='submit_line' <?php if($_GET["score21"]) print "style=display:none;" ?>>
+ <span id='roll_count' <?= roll_num() ?>>
+ Roll #<?= $_GET["roll_num"] ?>
+ </span>
+ <input id=roll_display type="submit" value="Roll!"
+ <?=show_roll()?>>
+ <input id='submit' type="submit" value="Submit">
+ </span>
+ <?=next_level()?>
+ <?=calc_score()?>
+ </form>
+
+ <h2>Scoreboard</h2>
+ <div id='full_scoreboard'>
+ <?=create_scoreboard()?>
+ </div>
+ </body>
+</html> \ No newline at end of file
diff --git a/instructions.html b/instructions.html
new file mode 100644
index 0000000..85b476a
--- /dev/null
+++ b/instructions.html
@@ -0,0 +1,35 @@
+<html>
+ <head>
+ <title>Instructions</title>
+ <link rel='stylesheet' href='yahtzee.css'/>
+ </head>
+
+ <body>
+ <a href='yahtzee.html'><span class='back'>&lt Go Back</span></a>
+ <h1 class='shifted_head'></h1> <!--code injected via 'make_head()'-->
+
+ <h2>In Yahtzee, you play with 5 Dice as seen below:</h2>
+
+ <div class=dice_display></div> <!--code injected via 'dice.render()'-->
+
+ <h2>You get 3 chances to roll every round. Try the roll button below:</h2>
+
+
+ <button id='roll_display' onclick='dice.render_dice()'>Roll</button>
+
+ <h2>Click on one of the Dice above to Hold it if you don't want to roll it again.<br/>
+ Doing so will display a <strong>hold</strong> icon below the die. Try it!</h2>
+
+ <h2>Every round, you will attempt to get different combinations with the dice. <br/>
+ Below are all the combinatinos from each round. <br/>
+ Click on one to see what it means.
+ </h2>
+
+ <div id='round_list'></div>
+
+ <div id='round_list2'></div>
+
+ <script type="text/javascript" src="instructions.js"></script>
+
+ </body>
+</html> \ No newline at end of file
diff --git a/instructions.js b/instructions.js
new file mode 100644
index 0000000..258d98a
--- /dev/null
+++ b/instructions.js
@@ -0,0 +1,127 @@
+var onOff = [0,0,0,0,0,0,0,0,0,0,0,0,0] ,
+ dice = {
+
+ vals:[0,0,0,0,0],
+ holds:[0,0,0,0,0],
+
+ hold_func:function(n){
+ dice.holds[n] = !dice.holds[n];
+ document.getElementById(`hold${n}`).innerHTML= (dice.holds[n]? "<div class='HOLD'>HOLD</div>":'&nbsp;')
+ console.log(dice.holds);
+ },
+ rand:function(){
+ return Math.ceil(Math.random()*6);
+ },
+ render_dice:function(dont_shuffle){
+ let out = '';
+ for(let i = 0; i < 5; i++){
+ dice.vals[i] = dice.holds[i] || dont_shuffle ? dice.vals[i] : dice.rand();
+ out +=
+ `<span class='dice_box'>
+ <button class='dice_click' onclick='dice.hold_func(${i})'>
+ <img class='dice_pics' src='${dice.vals[i]}.png' />
+ </button>
+ <div id='hold${i}'>` + (dice.holds[i]? "<div class='HOLD'>HOLD</div>":'&nbsp;') + `</div>
+ </span>`;
+ }
+ document.getElementsByClassName('dice_display')[0].innerHTML = out;
+ }
+ }
+
+function write_round(start, len){
+ dice.render_dice();
+ var rl_arr=[
+ 'Aces', 'Twos', 'Threes', 'Fours', 'Fives', 'Sixes',
+ '3 of a Kind', '4 of a Kind', 'Full House', 'Small Straight',
+ 'Large Straight', 'Yahtzee', 'Chance'
+ ],
+ r_array = [
+ `Roll for ones.
+ You score the sum of each 'one' after your third roll.`,
+
+ `Roll for twos.
+ You score the sum of each 'two' after your third roll,
+ where each two is worth two points.`,
+
+ `Roll for threes.
+ You score the sum of each 'three' after your third roll,
+ where each three is worth three points.`,
+
+ `Roll for fours.
+ You score the sum of each 'four' after your third roll,
+ where each four is worth four points.`,
+
+ `Roll for fives.
+ You score the sum of each 'five' after your third roll,
+ where each five is worth five points.`,
+
+ `Roll for sixes.
+ You score the sum of each 'six' after your third roll,
+ where each six is worth six points.`,
+
+ `Roll to get three of the same dice.
+ If you have 3 of a kind at the end of your third roll,
+ you score the sum of all dice. Otherwise no points are earned.`,
+
+ `Roll to get four of the same dice.
+ If you have 4 of a kind at the end of your third roll,
+ you score the sum of all dice. Otherwise no points are earned.`,
+
+ `Roll to get three of one number dice and two of another (ex. 2 2 5 2 5).
+ If a full house is achieved at the end of your third roll,
+ you score 25 points. Otherwise no points are earned.`,
+
+ `Roll to get a sequence of four dice (ex. 5 2 4 3 3).
+ If a small straight is achieved at the end of your third roll,
+ you score 30 points. Otherwise no points are earned.`,
+
+ `Roll to get a sequence of five dice (ex. 1 4 2 5 3).
+ If a large straight is achieved at the end of your third roll,
+ you score 40 points. Otherwise no points are earned.`,
+
+ `Roll to get all five of the same dice.
+ If you have a yahtzee at the end of your third roll,
+ you score 50 points and get the opportunity at the end of the game to score another Yahtzee,
+ called Yahtzee Bonus. If a Yahtzee Bonus is earned, you will score 100 points`,
+
+ `Roll for high numbers.
+ At the end of your third roll, you will score the sum of your dice.`
+ ];
+ let out = '';
+ for(var i = start; i < len+start; i++){
+ out += `<div class=round_line id='round` + i +
+ `' onclick=rule_show(` + i + `)><round>` + rl_arr[i] +
+ `</round><span class='dropdown'>v</span></div>
+ <div class='rule_show' style=display:none>` + r_array[i] +
+ `</div>`;
+ }
+ return out;
+}
+
+function make_head(header){
+ return `<img class='small_dice' src='${dice.rand()}.png'> ${header} <img class='small_dice' src='${dice.rand()}.png'>`;
+}
+
+
+document.getElementById('round_list').innerHTML = write_round(0, 6);
+document.getElementById('round_list2').innerHTML = write_round(6, 7);
+document.getElementsByClassName('shifted_head')[0].innerHTML = make_head("How to Play Yahtzee");
+
+function rule_show(occ) {
+ document.getElementsByClassName('rule_show')[occ].style.display=(onOff[occ]?'none':'block');
+ onOff[occ]=!onOff[occ];
+}
+/*setInterval(()=>{
+ document.querySelectorAll('.small_dice').forEach( i => { i.src=dice.rand() } )
+},4250); */
+
+/*
+javascript is very new; it got some kick ass short hand and tricks no other language got yet. for example, the " " or ' ' or ` `
+setTimeout( function(){} , 250) <-- what function to call after 250 miliSeconds
+setTimeout( ()=>{} , 250) <-- instead of "function()" you can type "()=>"
+
+function (a,b) { return a+b }
+(a,b)=>a+b <-- auto return the function body if it is NOT serrounding with a curly ; similar to the ( logic ? return-when-true : return-when-false )
+
+
+*/ \ No newline at end of file
diff --git a/instructions.php b/instructions.php
new file mode 100644
index 0000000..83ae357
--- /dev/null
+++ b/instructions.php
@@ -0,0 +1,55 @@
+<?php
+ session_start();
+ include 'scripts.php';
+ if(!isset($_SESSION['dice'])) $_SESSION['dice']=[0,0,0,0,0];
+?>
+
+<html>
+ <head>
+ <title>Instructions</title>
+ <link rel='stylesheet' href='yahtzee.css'/>
+ </head>
+
+ <body>
+ <?php
+ if(isset($_GET['dice']) && isset($_GET['val'])) {
+ $i = intval($_GET['dice']);
+ $v = intval($_GET['val']);
+ if($i>0 && $i<6 && $v>0 && $v<7) {
+ $_SESSION['dice'][$i-1]=$v;
+ print"set it up.... $i $v<br>\n";
+ } else print"out of range $i $v<br>\n";
+ } else print"Missing GET inputs<br>\n";
+
+ ?>
+
+ I remember you... you have this setup:<?=json_encode($_SESSION['dice'])?><br>
+
+ <a href='yahtzee.php'><span class='back'>&lt Go Back</span></a>
+ <h1 class='shifted_head'></h1> <!--code injected via 'make_head()'-->
+
+ <h2>In Yahtzee, you play with 5 Dice as seen below:</h2>
+
+ <div class=dice_display></div> <!--code injected via 'dice.render()'-->
+
+ <h2>You get 3 chances to roll every round. Try the roll button below:</h2>
+
+
+ <div id='roll_display'>Roll</div>
+
+ <h2>Click on one of the Dice above to Hold it if you don't want to roll it again.<br/>
+ Doing so will display a <strong>hold</strong> icon below the die. Try it!</h2>
+
+ <h2>Every round, you will attempt to get different combinations with the dice. <br/>
+ Below are all the combinatinos from each round. <br/>
+ Click on one to see what it means.
+ </h2>
+
+ <div id='round_list'></div>
+
+ <div id='round_list2'></div>
+
+ <script type="text/javascript" src="instructions.js"></script>
+
+ </body>
+</html> \ No newline at end of file
diff --git a/mode_select.html b/mode_select.html
new file mode 100644
index 0000000..3d7dcc2
--- /dev/null
+++ b/mode_select.html
@@ -0,0 +1,39 @@
+<!-- game.php?roll_num=0&round_num=0 -->
+
+<html>
+ <head>
+ <title>Yahtzee</title>
+ <link rel='stylesheet' href='yahtzee.css'/>
+ <style>
+ </style>
+ </head>
+
+ <body>
+ <a href='yahtzee.html'><span class='back'>&lt Go Back</span></a>
+ <h1 id='main_head'></h1> <!-- head inserted by make_head() -->
+
+ <a href='game.html'>
+ <div class='selector readybox' style='background-color:#e2d6b2'>
+ Click Here to Play in Forced Order Mode
+ </div>
+ </a>
+
+ <a href='free.html' ><!-- not final href -->
+ <div class='selector helpbox' style='background-color:#e2d6b2'>
+ Click Here to Play in Free Choice Mode
+ </div>
+ </a>
+
+ <script type="text/javascript">
+ function rand() {
+ return Math.ceil(Math.random()*6);
+ }
+
+ function make_head(header){
+ return `<img class='small_dice' src='${rand()}.png'> ${header} <img class='small_dice' src='${rand()}.png'>`;
+ };
+
+ document.getElementById('main_head').innerHTML = make_head('Pick Your Preferred Rules');
+ </script>
+ </body>
+</html> \ No newline at end of file
diff --git a/mode_select.php b/mode_select.php
new file mode 100644
index 0000000..9ac3224
--- /dev/null
+++ b/mode_select.php
@@ -0,0 +1,33 @@
+<!-- game.php?roll_num=0&round_num=0 -->
+
+<?php
+ include 'scripts.php';
+?>
+
+<html>
+ <head>
+ <title>Yahtzee</title>
+ <link rel='stylesheet' href='yahtzee.css'/>
+ <style>
+ </style>
+ </head>
+
+ <body>
+ <a href='yahtzee.php'><span class='back'>&lt Go Back</span></a>
+ <h1>
+ <?=make_head('Pick Your Preferred Rules')?>
+ </h1>
+
+ <a href='game.php?roll_num=0&round_num=0'>
+ <div class='selector readybox' style='background-color:#e2d6b2'>
+ Click Here to Play in Forced Order Mode
+ </div>
+ </a>
+
+ <a href='instructions.php' ><!-- not final href -->
+ <div class='selector helpbox' style='background-color:#e2d6b2'>
+ Click Here to Play in Free Choice Mode
+ </div>
+ </a>
+ </body>
+</html> \ No newline at end of file
diff --git a/pong.html b/pong.html
new file mode 100644
index 0000000..e0194be
--- /dev/null
+++ b/pong.html
@@ -0,0 +1,15 @@
+<div style='width:650px; height:300px;position:relative; border:1px solid #ccc'>
+ <b style='width:10px; height:10px; background:#000;position:absolute' id=ball></b>
+</div>
+<script>
+ var divH=document.querySelector('div').clientHeight,divW=document.querySelector('div').clientWidth;
+ var b=document.getElementById('ball'),x=divW/2-5,y=divH/2-5,dx=Math.random()*10-5,dy=Math.random()*10-5;
+ setInterval(function(){
+ b.style.left=x+'px'; b.style.top=y+'px';
+ x+=dx;
+ y+=dy;
+ if(y<1 || y>divH-11) dy=-dy;
+ if(x<1 || x>divW-11) dx=-dx;
+ },55);
+
+</script> \ No newline at end of file
diff --git a/scripts.php b/scripts.php
new file mode 100644
index 0000000..d04e7b2
--- /dev/null
+++ b/scripts.php
@@ -0,0 +1,299 @@
+<?php
+
+ //error_reporting(E_ERROR);
+ //////////GLOBAL VARIABLES/
+ ///////////////////////////
+ function dice_rand(){
+ return random_int(1, 6) . ".png";
+ }
+
+ function make_head($text){
+ return "<img class='small_dice' src=" . dice_rand() .
+ "/> $text <img class='small_dice' src=" . dice_rand() . "/>";
+ }
+
+ function display_dice_practice(){
+ $out = '';
+ for($i=1; $i<=5; $i++){
+ $see = "";
+ $shuffle = dice_rand();
+ if(isset($_GET["dice$i"]) && isset($_GET["held$i"]) && $_GET["dice$i"] == 'on'){ // isset(): exists? , empty() not set or the value is falsey like 0 or empty string
+ $see = 'checked';
+ $shuffle = $_GET["held$i"];
+ }
+ $out .=
+ "<span class='dice_box'>
+ <label for='dice$i'><img src='$shuffle' /></label>
+ <input id='dice$i' name='dice$i' type='checkbox' $see />
+ <input type='hidden' name='held$i' value='$shuffle' />
+ <div id='HOLD'>HOLD</div>
+ </span>
+ \n";
+
+ }
+
+ return $out;
+ }
+
+
+
+ function display_dice(){
+ $out='';
+ if(!$_GET["score21"]){
+ for($i=1; $i<=5; $i++){
+ $see = "";
+ $shuffle = dice_rand();
+ $show = "";
+ $Aces = "";
+ if($_GET["dice$i"] == 'on'){
+ $see = 'checked';
+ $shuffle = $_GET["held$i"];
+ }
+ if(empty($_GET["roll_num"])) {
+ $see = "";
+ $show = "style=opacity:0;";
+ }
+
+ $out .=
+ "<span class='dice_box'>
+ <label for='dice$i'><img class='dice_pics' src=$shuffle $show/></label>
+ <input id='dice$i' name='dice$i' type='checkbox' $see/>
+ <input type='hidden' name='held$i' value='$shuffle'/>
+ <div class='HOLD'>HOLD</div>
+ </span>
+ \n";
+ }
+ }
+
+ else {
+ $out .=
+ "<span id='game_over'>
+ <div id='Thanks'>Thanks for Playing!</div>
+ <div id='final_score'>Your Final Score: " . $_GET['score21'] . "</div>
+ <a class='end_select' id='play_again' href='game.php?roll_num=0&round_num=0'>
+ Click Here to Play Again
+ </a>
+ <a class='end_select' id='go_back' href='mode_select.php'>
+ Click Here to Go Back
+ </a>
+ </span>";
+ }
+
+ return $out;
+ }
+
+ function roll_num(){
+ return (empty($_GET["roll_num"])?"style=color:orange;":"");
+ }
+
+ function show_roll(){
+ return (isset($_GET["roll_num"]) && $_GET["roll_num"] == 3 ? "style=opacity:0":"");
+ }
+
+ function next_level(){
+ $roll = $_GET["roll_num"]+1;
+ $round = $_GET["round_num"];
+
+ if($roll > 3){
+ $roll = 0;
+ $round = $_GET["round_num"]+1;
+ }
+ return
+ "<input type='hidden' name='roll_num' value='$roll'/>\n" .
+ "<input type='hidden' name='round_num' value='$round'/>";
+ }
+
+ function total_upper(){
+ $ret = 0;
+ for($i = 1; $i <= 6; $i++){
+ (is_numeric($_GET["score$i"])?$ret += $_GET["score$i"]:0);
+ }
+ return $ret;
+ }
+
+ function bonus_bool(){
+ return (isset($_GET["score7"]) && $_GET["score7"] >= 63 ? 35:0);
+ }
+
+ function oak($num_of_kind,&$dice_number){
+ $ret=0;
+ for($n = 1; $n <= 6; $n++) if ($n!=$dice_number) { // n is the dice number I am chekcing, like "5"
+ $count = 0;
+ for($i = 1; $i <= 5; $i++){ // how many "5"s I have
+ if($_GET["held$i"] == "$n.png") $count++;
+ }
+ if($count >= $num_of_kind) {
+ $dice_number = $n;
+ $n=99;
+ }
+ }
+ if($n>20){
+ for($i = 1; $i <= 5; $i++) $ret += substr($_GET["held$i"], 0, 1);
+ }
+ return $ret;
+ }
+
+ function is_full_house(){
+ $dn=0;
+ if (oak(3,$dn)){
+ if(oak(2,$dn)) return 25;
+ }
+ return 0;
+ }
+
+ function straight($size){
+ $str = "";
+ $count = 0;
+ $p = 0;
+ for($i = 1; $i <= 5; $i++){
+ $str .= substr($_GET["held$i"], 0, 1);
+ }
+ for($a = 4+($size-4); $a <= 6; $a++){
+ $count = 0;
+ for($b = $a-3-($size-4); $b <= $a; $b++){
+ if((strpos($str, (string)$b)) !== False) $count++;
+ }
+ if($count >= $size){
+ $p = 30+(($size-4)*10);
+ break;
+ }
+ }
+ return $p;
+ }
+
+ function Chance(){
+ $sum = 0;
+ for($i = 1; $i <= 5; $i++){
+ (is_numeric(substr($_GET["held$i"], 0, 1))?
+ $sum += substr($_GET["held$i"], 0, 1):0);
+ }
+ return $sum;
+ }
+
+ function Yahtzee(){
+ $x3 = 10;
+ return ((oak(5,$x3)) ? 50:0);
+ }
+
+ function y_bonus(){
+ return (Yahtzee() > 0 ? "✓":"test");
+ }
+
+ function total_lower(){
+ $ret = 0;
+ for($i = 10; $i <= 18; $i++){
+ (is_numeric($_GET["score$i"])?$ret += $_GET["score$i"]:0);
+ }
+ return $ret;
+ }
+
+ function calc_score(){
+ $score = "";
+ ////array for scoring procedures////
+ $x1 = 0;
+ $x2 = 9;
+ $cont = 0;
+ $scoring_array =
+ [oak(3,$x1), oak(4,$x2), is_full_house(),
+ straight(4), straight(5), Yahtzee(), Chance()];
+
+ if($_GET["score15"]){
+ $cont++;
+ }
+
+ $points = [];
+ for($a = 1; $a <= 21+$cont; $a++){
+ $points[$a] = $_GET["score$a"];
+ if($a <= 6) {
+ if(($_GET["roll_num"] == 0) && ($_GET["round_num"] == $a)){
+ $points[$a] = 0;
+ for($i = 1; $i <= 5; $i++){
+ if($_GET["held$i"] == "$a.png") $points[$a] += $a;
+ }
+ }
+ }
+
+ elseif($_GET["round_num"] > 13){
+ if($cont && ($_GET["roll_num"] == 0)){
+ $points[17] = y_bonus();
+ $points[18] = Yahtzee()*2;
+ }
+ }
+
+ if($_GET["round_num"] >= 13+$cont){
+ $points[19] = $points[9];
+ $points[20] = total_lower();
+ $points[21] = $points[9] + $points[20];
+ }
+
+
+ if($a > 9 && $a < 17){
+ if(($_GET["roll_num"] == 0) && ($_GET["round_num"] == $a-3)){
+ $points[$a] = $scoring_array[$a-10];
+ }
+ }
+
+ elseif($_GET["round_num"] >= 6){
+ $points[7] = total_upper();
+ $points[8] = bonus_bool();
+ $points[9] = total_upper() + bonus_bool();
+ }
+
+
+ $score .= "<input type='hidden' name='score$a' value=$points[$a]>\n";
+ $_GET["score$a"]=$points[$a];
+ }
+ return $score;
+ }
+
+ function create_scoreboard(){
+ $round_val =
+ ['UPPER SECTION', 'Aces', 'Twos', 'Threes', 'Fours', 'Fives', 'Sixes', 'TOTAL SCORE', 'BONUS', 'TOTAL',
+ '3 of a Kind', '4 of a Kind', 'Full House', 'Small Straight', 'Large Straight', 'YAHTZEE', 'Chance',
+ 'YAHTZEE BONUS ✓s', 'YAHTZEE BONUS scoring', 'TOTAL UPPER', 'TOTAL LOWER', 'GRAND TOTAL'];
+ $out = '';
+ $score_val = [];
+ $score_val[0] = "";
+ $score_val[1] = "";
+ for($i=1; $i <= 21; $i++){
+ $score_val[$i+1] = $_GET["score$i"];
+ }
+
+ for($a=1; $a <= 2; $a++){
+ if($a == 2){
+ $out .= "<div id='LOWER'>LOWER SECTION</div> \n";
+ }
+ $out .= "<div id='score_section$a'> \n";
+
+ for($i=1; $i <= 8+$a*2; $i++){
+ $out .= "<div class='grid_container gc$a' id='grid_element" . ($i + ($a-1)*10) . "'>" .
+ $round_val[($i-1)+($a-1)*10];
+ if($a == 1) $out .= "<span id='score_val'>" . $score_val[$i] . "</span>";
+ else $out .= "<span id='score_val'>" . $score_val[$i+10] . "</span>";
+ $out .= "</div> \n";
+ }
+ $out .= '</div>';
+ }
+ return $out;
+ }
+
+ function determine_reminder(){
+ $r = $_GET["round_num"];
+ $round_val =
+ ['Aces', 'Twos', 'Threes', 'Fours', 'Fives', 'Sixes',
+ '3 of a Kind', '4 of a Kind', 'Full House',
+ 'Small Straight', 'Large Straight', 'YAHTZEE', 'Chance'];
+ if($_GET["score15"]) array_push($round_val, 'YAHTZEE Bonus');
+ return strtoupper($round_val[$r]);
+ }
+
+ function check_end(){
+ $out = '';
+ if(!$_GET["score21"]){
+ $out .=
+ "<h2 id='reminder'>You are rolling for: <span>" . determine_reminder() . "</span></h2>";
+ }
+ return $out;
+ }
+
+?> \ No newline at end of file
diff --git a/sql_00.php b/sql_00.php
new file mode 100644
index 0000000..38ee4f2
--- /dev/null
+++ b/sql_00.php
@@ -0,0 +1,45 @@
+<?php
+
+$host = '35.185.89.47';
+$dbs = 'wowStats';
+$user = 'website';
+$pass = '!fast$';
+
+
+$db = mysqli_connect($host, $user, $pass, $dbs);
+
+if (!$db) {
+ die("Error: Unable to connect to MySQL<br>Debugging error: <code>" .
+ mysqli_connect_error() . "</code><br>\n");
+}
+
+$q="select id,full_name,addr1,addr2,city,state,postal from amz_sh_customers where tel='' limit 10";
+if ($res=mysqli_query($db,$q)){
+ while($r = mysqli_fetch_assoc($res)){
+ print"{$r['id']}. Name: {$r['full_name']}<br>\n";
+ // later when updating it will look like this:
+ // $q="update amz_sh_customers set tel='1',email='$email_list' where id={$r['id']}";
+ }
+} else print"$q failed: ".mysqli_error($db)."<br>\n";
+
+mysqli_close($db);
+
+
+
+//2016-06-22 support for EmailOversight U: shai@inetb.com P: 5146_Drd
+// documentation https://login.emailoversight.com/ApiPage/EmailAppend
+/*
+GET URL: https://api.emailoversight.com/api/EmailAppend?apitoken=2ed8c5a6-5597-4b69-bdb0-a854504d8472&lastname={LastName}&firstname={FirstName}&postalcode={PostalCode}&middlename=&formattedaddress=&zip4=
+*/
+$url="https://api.emailoversight.com/api/EmailValidation?apitoken=2ed8c5a6-5597-4b69-bdb0-a854504d8472&listid=3117&email=$e";
+
+
+$ch = curl_init('http://google.com');
+curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1) ;
+$res = curl_exec ($ch);
+// if res is JSON, you can use $PHP_normal_assosiate_array = json_decode($res,1)
+// to see the array visually, use print_r($arr);
+curl_close ($ch);
+print"After talking to google, I got back ".strlen($res).
+ " bytes back<br> The return starts like this<xmp>".substr($res,200)."</xmp>";
+?>
diff --git a/test.html b/test.html
new file mode 100644
index 0000000..bdb3514
--- /dev/null
+++ b/test.html
@@ -0,0 +1 @@
+<label for="" \ No newline at end of file
diff --git a/test.php b/test.php
new file mode 100644
index 0000000..c1c7c22
--- /dev/null
+++ b/test.php
@@ -0,0 +1,17 @@
+<?php
+ //////////GLOBAL VARIABLES/
+ global $dice_arr;
+ $dice_arr = [];
+ for($i=1; $i<=6; $i++){
+ array_push($dice_arr, $i . ".png");
+ }
+ ///////////////////////////
+ function dice_rand(){
+ $dice_arr = $GLOBALS['dice_arr'];
+ $e = random_int(0, 5);
+ return $dice_arr[$e];
+ }
+
+ print dice_rand();
+
+?> \ No newline at end of file
diff --git a/test2.html b/test2.html
new file mode 100644
index 0000000..b920a78
--- /dev/null
+++ b/test2.html
@@ -0,0 +1,8 @@
+<script>
+ if(!true){
+ let age=22;
+ alert("happy "+age+"'s birthday");
+ }
+ alert("Not your birthday... come back when you are "+age1);
+
+</script> \ No newline at end of file
diff --git a/test2.php b/test2.php
new file mode 100644
index 0000000..433d0ae
--- /dev/null
+++ b/test2.php
@@ -0,0 +1,6 @@
+<?php
+
+ $test = "55553";
+
+ if((strpos($test, 5)) !== False) print "yes";
+?> \ No newline at end of file
diff --git a/yahtzee.css b/yahtzee.css
new file mode 100644
index 0000000..d9ed106
--- /dev/null
+++ b/yahtzee.css
@@ -0,0 +1,277 @@
+*{
+ border: 0;
+ margin: 0;
+ text-align: center;
+}
+
+body{
+ background-color: #ffd555;
+}
+
+/*BACK BUTTON*/
+.back{
+ background-color: #5fc2ef;
+ float: left;
+ padding: 0.5vw;
+ text-decoration: underline;
+ font-family: monospace;
+}
+
+h1{
+ padding: 1.784vw;
+ font-size: 250%;
+ background-color: #5fc2ef;
+}
+
+.shifted_head{
+ padding-right: 6vw;
+}
+
+h2{
+ padding: 1.5vw;
+}
+ /* BIG BUTTONS ON MAIN PAGE */
+.selector{
+ background-color: gray;
+ border: 5px solid white;
+ border-radius: 10px;
+ width: 25vw;
+ padding-top: 12vh;
+ padding-bottom: 12vh;
+ padding-left: 10.9375vw;
+ padding-right: 10.9375vw;
+ margin-top: 4.167vh;
+ margin-bottom: 4.167vh;
+ font-size: 5vw;
+ height: 51.506vh;
+}
+
+.small_dice{
+ width: 2.5%;
+}
+
+a{
+ color: black;
+}
+
+.readybox{
+ float: left;
+ margin-left: 1.25vw;
+}
+
+.helpbox{
+ float: right;
+ margin-right: 1.25vw;
+}
+
+.dice_box{
+ text-align: center;
+}
+
+.dice_display{
+ display: flex;
+ height: 214px;
+}
+
+.dice_box button{
+ background-color: inherit;
+}
+
+.dice_pics{
+ width: 64%
+}
+
+/*.dice_box input:checked ~ div { opacity: 1;}*/
+
+#roll_display, #roll_display_free{
+ width: 12vw;
+ background-color: #b7b5b5;
+ border: 5px solid black;
+ margin: 0 auto;
+ border-radius: 20px;
+ padding-top: 1.2vh;
+ padding-bottom: 1.2vh;
+ font-size: 1.5vw;
+ font-weight: bold;
+ margin-top: 10px;
+ margin-bottom: 10px;
+}
+
+#roll_display_free{
+ margin-left: 24.5vw;
+}
+
+.HOLD{
+ padding-top: 10px;
+ padding-bottom: 10px;
+ margin-top: 10px;
+ margin-left: 25px;
+ margin-right: 25px;
+ background-color: orange;
+ font-weight: bold;
+ border: 2px solid black;
+ border-radius: 15px;
+}
+
+#round_list, #round_list2{
+ width: 48.5vw;
+ border: 2px solid gray;
+ background-color: #dedcdc;
+ margin-bottom: 50px;
+}
+
+#round_list{
+ float: left;
+}
+
+#round_list2{
+ float: right;
+}
+
+.round_line{
+ display: block;
+ border: 2px solid gray;
+ padding: 2.5px;
+}
+
+round{
+ font-size: 20px;
+ background-color: inherit;
+}
+
+.dropdown{
+ float: right;
+ background-color: inherit;
+ font-family: sans-serif;
+ text-align: right;
+}
+
+.rule_show{
+ background-color: gray;
+ padding: 50px;
+ color: gold;
+ font-size: 20px;
+}
+
+.top_pad{
+ padding-top: 20px;
+}
+
+.top_pad_free{
+ padding-top: 50px;
+}
+
+#full_scoreboard{
+ width: 800px;
+ height: 1167.87px;
+ border: 5px solid black;
+ border-radius: 2px;
+ margin: 0 auto;
+ background-color: #e2e2e2;
+}
+
+#score_section1, #score_section2{
+ width: 786px;
+ border: 2px solid black;
+ margin: 5px auto 0;
+}
+
+#score_section2{
+ margin-top: 35px;
+}
+
+#LOWER{
+ float: left;
+ font-weight: bold;
+ padding-left: 24px;
+ padding-top: 10px;
+}
+
+.grid_container{
+ border: 1px solid black;
+ /*padding-top: 15px;
+ padding-left: 15px;
+ text-align: left;*/
+ font-weight: bold;
+ display: grid;
+ grid-template-columns: 1fr 97px;
+}
+.grid_container > span:first-child {
+ text-align: left;
+ padding:15px;
+}
+#grid_element18{
+ border-bottom: initial;
+}
+
+#grid_element19{
+ border-top: initial;
+}
+
+#reminder span{
+ color: red;
+}
+
+#roll_count, #submit{
+ margin: 10px;
+ font-weight: bold;
+ font-size: 20px;
+}
+
+#roll_count{
+ float: left;
+ margin-left: 120px;
+ background-color: orange;
+ padding: 20px;
+}
+
+#submit{
+ float: right;
+ margin-right: 9.5vw;
+ padding: 20px;
+ background-color: #00b8ff;
+ border: 2px solid white;
+ border-radius: 20px;
+}
+
+#submit_line{
+ display: flex;
+}
+
+.score_val{
+ border-left: 2px solid #000;
+ text-align: right;
+ padding: 15px 38px 15px 0;
+}
+
+#game_over{
+ margin: 0 auto;
+ margin-bottom: 20px;
+}
+
+#Thanks{
+ font-size: 7vw;
+ font-weight: bold;
+ font-family: cursive;
+ color: #8a0d0d;
+ padding-bottom: 5vw;
+}
+
+#final_score{
+ font-size: 10vw;
+ font-family: fantasy;
+ letter-spacing: 3px;
+ color: #632c94;
+ margin-bottom: 5vw;
+}
+
+.end_select{
+ font-size: 3vw;
+ font-style: italic;
+ padding: 10px;
+ margin-right: 50px;
+ margin-left: 50px;
+ color: #ffd;
+ background-color: #805058;
+ border-radius: 8px;
+} \ No newline at end of file
diff --git a/yahtzee.html b/yahtzee.html
new file mode 100644
index 0000000..d004766
--- /dev/null
+++ b/yahtzee.html
@@ -0,0 +1,34 @@
+<html>
+ <head>
+ <title>Yahtzee</title>
+ <link rel='stylesheet' href='yahtzee.css'/>
+ </head>
+
+ <body>
+ <h1 id='main_head'></h1> <!--Head inserted via make_head()-->
+
+ <a href='mode_select.html'>
+ <div class='selector readybox'>
+ Click Here if You Already Know How to Play
+ </div>
+ </a>
+
+ <a href='instructions.html'>
+ <div class='selector helpbox'>
+ Click Here to Learn How to Play
+ </div>
+ </a>
+
+ <script type="text/javascript">
+ function rand() {
+ return Math.ceil(Math.random()*6);
+ }
+
+ function make_head(header){
+ return `<img class='small_dice' src='${rand()}.png'> ${header} <img class='small_dice' src='${rand()}.png'>`;
+ };
+
+ document.getElementById('main_head').innerHTML = make_head("Welcome to Yahtzee");
+ </script>
+ </body>
+</html> \ No newline at end of file
diff --git a/yahtzee.php b/yahtzee.php
new file mode 100644
index 0000000..ee5a385
--- /dev/null
+++ b/yahtzee.php
@@ -0,0 +1,28 @@
+<?php
+ include 'scripts.php';
+?>
+
+<html>
+ <head>
+ <title>Yahtzee</title>
+ <link rel='stylesheet' href='yahtzee.css'/>
+ </head>
+
+ <body>
+ <h1>
+ <?=make_head('Welcome to Yahtzee')?>
+ </h1>
+
+ <a href='mode_select.php'>
+ <div class='selector readybox'>
+ Click Here if You Already Know How to Play
+ </div>
+ </a>
+
+ <a href='instructions.php'>
+ <div class='selector helpbox'>
+ Click Here to Learn How to Play
+ </div>
+ </a>
+ </body>
+</html> \ No newline at end of file
diff --git a/yahtzee_legacy.css b/yahtzee_legacy.css
new file mode 100644
index 0000000..6ce2f41
--- /dev/null
+++ b/yahtzee_legacy.css
@@ -0,0 +1,276 @@
+*{
+ border: 0;
+ margin: 0;
+ text-align: center;
+}
+
+body{
+ background-color: #ffd555;
+}
+
+/*BACK BUTTON*/
+.back{
+ background-color: #5fc2ef;
+ float: left;
+ padding: 0.5vw;
+ text-decoration: underline;
+ font-family: monospace;
+}
+
+h1{
+ padding: 1.784vw;
+ font-size: 250%;
+ background-color: #5fc2ef;
+}
+
+.shifted_head{
+ padding-right: 6vw;
+}
+
+h2{
+ padding: 1.5vw;
+}
+ /* BIG BUTTONS ON MAIN PAGE */
+.selector{
+ background-color: gray;
+ border: 5px solid white;
+ border-radius: 10px;
+ width: 25vw;
+ padding-top: 12vh;
+ padding-bottom: 12vh;
+ padding-left: 10.9375vw;
+ padding-right: 10.9375vw;
+ margin-top: 4.167vh;
+ margin-bottom: 4.167vh;
+ font-size: 5vw;
+ height: 51.506vh;
+}
+
+.small_dice{
+ width: 2.5%;
+}
+
+a{
+ color: black;
+}
+
+.readybox{
+ float: left;
+ margin-left: 1.25vw;
+}
+
+.helpbox{
+ float: right;
+ margin-right: 1.25vw;
+}
+
+.dice_box{
+ text-align: center;
+}
+
+.dice_display{
+ display: flex;
+}
+
+.dice_box button{
+ background-color: inherit;
+}
+
+.dice_pics{
+ width: 64%
+}
+
+.dice_box input:checked ~ div { opacity: 1;}
+.dice_box div{ opacity: 0; }
+
+.dice_box > input{
+ display: none;
+}
+
+#roll_display{
+ display: inline;
+ width: 12vw;
+ height: 4vw;
+ background-color: #b7b5b5;
+ border: 5px solid black;
+ margin: 0 auto;
+ border-radius: 20px;
+ padding-top: 1.2vh;
+ padding-bottom: 1.2vh;
+ font-size: 1.5vw;
+ font-weight: bold;
+ margin-top: 10px;
+ margin-bottom: 10px;
+}
+
+.HOLD{
+ padding-top: 10px;
+ padding-bottom: 10px;
+ margin-top: 10px;
+ margin-left: 25px;
+ margin-right: 25px;
+ background-color: orange;
+ font-weight: bold;
+ border: 2px solid black;
+ border-radius: 15px;
+ opacity: 0;
+}
+
+#round_list, #round_list2{
+ width: 48.5vw;
+ border: 2px solid gray;
+ background-color: #dedcdc;
+}
+
+#round_list{
+ float: left;
+}
+
+#round_list2{
+ float: right;
+}
+
+.round_line{
+ display: block;
+ border: 2px solid gray;
+ padding: 2.5px;
+}
+
+round{
+ font-size: 20px;
+ background-color: inherit;
+}
+
+.dropdown{
+ float: right;
+ background-color: inherit;
+ font-family: sans-serif;
+ text-align: right;
+}
+
+.rule_show{
+ background-color: gray;
+ padding: 50px;
+ color: gold;
+ font-size: 20px;
+}
+
+.top_pad{
+ padding-top: 20px;
+}
+
+#full_scoreboard{
+ width: 800px;
+ height: 1167.87px;
+ border: 5px solid black;
+ border-radius: 2px;
+ margin: 0 auto;
+ background-color: #e2e2e2;
+}
+
+#score_section1, #score_section2{
+ width: 786px;
+ height: 506px;
+ border: 2px solid black;
+ margin: 0 auto;
+ margin-top: 5px;
+ display: grid;
+ /* grid-template-columns: auto auto auto auto; */
+}
+
+#score_section2{
+ margin-top: 35px;
+ height: 607.2px;
+}
+
+#LOWER{
+ float: left;
+ font-weight: bold;
+ padding-left: 24px;
+ padding-top: 10px;
+}
+
+.grid_container{
+ border: 1px solid black;
+ padding-top: 15px;
+ padding-left: 15px;
+ text-align: left;
+ font-weight: bold;
+}
+
+#grid_element18{
+ border-bottom: initial;
+}
+
+#grid_element19{
+ border-top: initial;
+}
+
+#reminder span{
+ color: red;
+}
+
+#roll_count, #submit{
+ margin: 10px;
+ font-weight: bold;
+ font-size: 20px;
+}
+
+#roll_count{
+ float: left;
+ margin-left: 9.5vw;
+ background-color: orange;
+ padding: 20px;
+}
+
+#submit{
+ float: right;
+ margin-right: 9.5vw;
+ padding: 20px;
+ background-color: #00b8ff;
+ border: 2px solid white;
+ border-radius: 20px;
+}
+
+#submit_line{
+ display: flex;
+}
+
+#score_val{
+ float: right;
+ margin-right: 50px;
+ padding-left: 50px;
+ border-left: 2px solid black;
+}
+
+#game_over{
+ margin: 0 auto;
+ margin-bottom: 20px;
+}
+
+#Thanks{
+ font-size: 7vw;
+ font-weight: bold;
+ font-family: cursive;
+ color: #8a0d0d;
+ padding-bottom: 5vw;
+}
+
+#final_score{
+ font-size: 10vw;
+ font-family: fantasy;
+ letter-spacing: 3px;
+ color: #632c94;
+ margin-bottom: 5vw;
+}
+
+.end_select{
+ font-size: 3vw;
+ font-style: italic;
+ padding: 10px;
+ margin-right: 50px;
+ margin-left: 50px;
+ color: #ffd;
+ background-color: #805058;
+ border-radius: 8px;
+} \ No newline at end of file