Skip to content

Commit

Permalink
left and right columns, sorted remaining cases
Browse files Browse the repository at this point in the history
  • Loading branch information
matthewsamuel95 authored Nov 29, 2016
1 parent bebbd4c commit 25f5e2e
Show file tree
Hide file tree
Showing 3 changed files with 59 additions and 34 deletions.
8 changes: 4 additions & 4 deletions DealorNoDeal.css
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ body {
}

p{
font-size: 24pt;
font-family: fantasy;
font-size: 20pt;
font-family: monospace;
}

input{
Expand All @@ -17,12 +17,12 @@ input{

h1{
font-size: 50pt;
font-family: cursive;
font-family:inherit;
}

h2{
font-family: sans-serif;
font-size: 50pt;
font-size: 20pt;
color: darkgreen;
}
h3{
Expand Down
21 changes: 20 additions & 1 deletion DealorNoDeal.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,9 @@ function myFunction(buttonP){
var x=buttonP;
if (typeof x != 'undefined'){
//document.getElementById("message").innerHTML = cases[x-1];
if(cases[x-1]!=0)
document.getElementById("case").innerHTML =
"That case was valued at: $"+cases[x-1];
cases[x-1]=0;
}

Expand All @@ -55,7 +58,23 @@ function myFunction(buttonP){
var average;
average=(sum-1)/(howmany-1);
document.getElementById("message").innerHTML = "$"+average.toFixed(2);


var result = [];
for(var p=1;p<26;p++){
if(cases[p-1]!=0){
result.push(cases[p-1]);
}
}

result.sort(function(a, b){return a-b})
var theAnswer="";
for(var p=1;p<result.length+1;p++){
theAnswer+=" $"+result[p-1];
if(p%2==0)
theAnswer+="<div>";

}
document.getElementById("remain").innerHTML = theAnswer;
}

function checkNum() {
Expand Down
64 changes: 35 additions & 29 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -10,48 +10,54 @@
</head>
<body lang="en-US" onload="start()">
<h1>
Deal or No Deal Round 1
Deal or No Deal
</h1>
<div style="float: left; width: 20%;">
<p id=remain> Remain </p>
</div>
<div style="float: right; width: 80%;">
<p>
<button onclick="myFunction();"; value=1>1</button>
<button onclick="myFunction()"; value=2>2</button>
<button onclick="myFunction()"; value=3>3</button>
<button onclick="myFunction()"; value=4>4</button>
<button onclick="myFunction()"; value=5>5</button>
<button onclick="myFunction()" value=1>1</button>
<button onclick="myFunction()" value=2>2</button>
<button onclick="myFunction()" value=3>3</button>
<button onclick="myFunction()" value=4>4</button>
<button onclick="myFunction()" value=5>5</button>
</br>
<button onclick="myFunction()"; value=6>6</button>
<button onclick="myFunction()"; value=7>7</button>
<button onclick="myFunction()"; value=8>8</button>
<button onclick="myFunction()"; value=9>9</button>
<button onclick="myFunction()"; value=10>10</button>
<button onclick="myFunction()" value=6>6</button>
<button onclick="myFunction()" value=7>7</button>
<button onclick="myFunction()" value=8>8</button>
<button onclick="myFunction()" value=9>9</button>
<button onclick="myFunction()" value=10>10</button>
</br>
<button onclick="myFunction()"; value=11>11</button>
<button onclick="myFunction()"; value=12>12</button>
<button onclick="myFunction()"; value=13>13</button>
<button onclick="myFunction()"; value=14>14</button>
<button onclick="myFunction()"; value=15>15</button>
<button onclick="myFunction()" value=11>11</button>
<button onclick="myFunction()" value=12>12</button>
<button onclick="myFunction()" value=13>13</button>
<button onclick="myFunction()" value=14>14</button>
<button onclick="myFunction()" value=15>15</button>
</br>
<button onclick="myFunction()"; value=16>16</button>
<button onclick="myFunction()"; value=17>17</button>
<button onclick="myFunction()"; value=18>18</button>
<button onclick="myFunction()"; value=19>19</button>
<button onclick="myFunction()"; value=20>20</button>
<button onclick="myFunction()" value=16>16</button>
<button onclick="myFunction()" value=17>17</button>
<button onclick="myFunction()" value=18>18</button>
<button onclick="myFunction()" value=19>19</button>
<button onclick="myFunction()" value=20>20</button>
</br>
<button onclick="myFunction()"; value=21>21</button>
<button onclick="myFunction()"; value=22>22</button>
<button onclick="myFunction()"; value=23>23</button>
<button onclick="myFunction()"; value=24>24</button>
<button onclick="myFunction()"; value=25>25</button>
<button onclick="myFunction()" value=21>21</button>
<button onclick="myFunction()" value=22>22</button>
<button onclick="myFunction()" value=23>23</button>
<button onclick="myFunction()" value=24>24</button>
<button onclick="myFunction()" value=25>25</button>
</br>
</p>
<h2 id=case> Case Value </h2>
<h3 id=message> Offer </h3>
</div>
<!--jquery -->
<script>
$( "button" ).click(function()
$("button").click(function()
{
$( this ).hide( 1000, function()
$(this).hide(1000, function()
{
$( this ).remove();
$(this).remove();
});
});

Expand Down

0 comments on commit 25f5e2e

Please sign in to comment.