Semester 3 pog

This commit is contained in:
2023-08-16 17:31:33 -05:00
parent 2dc89a3b93
commit a33c99cbd2
1558 changed files with 439 additions and 0 deletions

View File

@@ -0,0 +1,3 @@
{
"directory": "public_html/bower_components"
}

View File

@@ -0,0 +1,9 @@
/*
* Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
* Click nbfs://nbhost/SystemFileSystem/Templates/ClientSide/Gruntfile.js to edit this template
*/
module.exports = function (grunt) {
// Project configuration.
grunt.initConfig({
});
};

View File

@@ -0,0 +1,13 @@
{
"name": "MP12_CalebFontenot",
"version": "1.0.0",
"main": "path/to/main.css",
"ignore": [
".jshintrc",
"**/*.txt"
],
"dependencies": {
},
"devDependencies": {
}
}

View File

@@ -0,0 +1,10 @@
/*
* Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
* Click nbfs://nbhost/SystemFileSystem/Templates/ClientSide/gulpfile.js to edit this template
*/
var gulp = require('gulp');
gulp.task('default', function () {
// place code for your default task here
});

View File

@@ -0,0 +1 @@
browser=SL[/Browsers/FirefoxBrowser

View File

@@ -0,0 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<project-private xmlns="http://www.netbeans.org/ns/project-private/1">
<editor-bookmarks xmlns="http://www.netbeans.org/ns/editor-bookmarks/2" lastBookmarkId="0"/>
<open-files xmlns="http://www.netbeans.org/ns/projectui-open-files/2">
<group/>
</open-files>
</project-private>

View File

@@ -0,0 +1,5 @@
file.reference.MP12_CalebFontenot-public_html=public_html
file.reference.MP12_CalebFontenot-test=test
files.encoding=UTF-8
site.root.folder=${file.reference.MP12_CalebFontenot-public_html}
test.folder=${file.reference.MP12_CalebFontenot-test}

View File

@@ -0,0 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://www.netbeans.org/ns/project/1">
<type>org.netbeans.modules.web.clientproject</type>
<configuration>
<data xmlns="http://www.netbeans.org/ns/clientside-project/1">
<name>MP12_CalebFontenot</name>
</data>
</configuration>
</project>

View File

@@ -0,0 +1,8 @@
{
"name": "MP12_CalebFontenot",
"version": "1.0.0",
"keywords": ["util", "functional", "server", "client", "browser"],
"author": "caleb",
"contributors": [],
"dependencies": {}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 17 KiB

View File

@@ -0,0 +1,83 @@
<!DOCTYPE html>
<!--
Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
Click nbfs://nbhost/SystemFileSystem/Templates/Other/html.html to edit this template
-->
<html>
<head>
<title>Dice</title>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
</head>
<body>
<label id="valueOutput"></label><br>
<label id="score"></label><br>
<label id="PlayerText">Your Dice roll:</label><br>
<label id="playerDie"></label><br>
<label id="cpuText">CPU Dice roll:</label><br>
<label id="cpuDie"></label>
<label id="input"><input type="button" onclick="onClick()" value="Roll Die"/></label>
</body>
<script>
var cpuDieRoll = 0, playerDieRoll = 0, diceValues = {"playerDie": {}, "cpuDie": {}}, cpuTotalScore = 0, playerTotalScore = 0;
function onClick() {
playerDieRoll = rollDie("playerDie");
cpuDieRoll = rollDie("cpuDie");
writeValue(determineScore());
}
function printDie(dieNumber, elementId) {
let filename = "DieSet/Die" + dieNumber + ".png";
document.getElementById(elementId).innerHTML += "<image src=" + filename + ">";
//document.getElementById("wager").innerHTML = JSON.stringify(diceValues)
}
function rollDie(id) {
document.getElementById(id).innerHTML = "";
let diceTotal = 0;
for (let i = 0; i < 2; i++) {
let dieValue = Math.trunc((Math.random() * 6) + 1);
printDie(dieValue, id);
if (id === "playerDie") {
diceValues.playerDie["roll" + (i + 1)] = dieValue;
} else {
diceValues.cpuDie["roll" + (i + 1)] = dieValue;
}
diceTotal += dieValue;
}
return diceTotal;
}
function writeValue([playerRollScore, cpuRollScore]) {
document.getElementById("valueOutput").innerHTML = "Your Dice roll: " + playerRollScore + "; "
document.getElementById("valueOutput").innerHTML += "CPU Dice roll: " + cpuRollScore;
}
function determineScore() {
//Add rolls together
let playerRollScore = diceValues.playerDie["roll1"] + diceValues.playerDie["roll2"];
let cpuRollScore = diceValues.cpuDie["roll1"] + diceValues.cpuDie["roll2"];
let winString = "";
if (cpuDieRoll == playerDieRoll) {
winString = " It's a tie, no one won :("
} else {
if (playerRollScore > cpuRollScore) {
winString = " Player won!";
if (diceValues.playerDie["roll1"] == diceValues.playerDie["roll2"]) {
//double is rolled for player
playerRollScore = playerRollScore * 2;
winString = " Player won and rolled a double!";
}
playerTotalScore += playerRollScore;
} else {
winString = " CPU Won!"
if (diceValues.cpuDie["roll1"] == diceValues.cpuDie["roll2"]) {
//double is rolled for cpu
cpuRollScore = cpuRollScore * 2;
winString = " CPU won and rolled a double!"
}
cpuTotalScore += cpuRollScore;
}
}
document.getElementById("score").innerHTML = "Total Score: Player: " + playerTotalScore + "; CPU: " + cpuTotalScore + winString;
return [playerRollScore, cpuRollScore];
}
</script>
</html>

View File

@@ -0,0 +1,108 @@
<!DOCTYPE html>
<!--
Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
Click nbfs://nbhost/SystemFileSystem/Templates/Other/html.html to edit this template
-->
<html>
<head>
<title>Dice</title>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
</head>
<body>
<label id="valueOutput"></label><br>
<label id="score"></label><br>
<label id="wager"></label><br>
<label id="poolStats"></label><br>
<label id="PlayerText">Your Dice roll:</label><br>
<label id="playerDie"></label><br>
<label id="cpuText">CPU Dice roll:</label><br>
<label id="cpuDie"></label><br>
<label>Enter the amount of money to add to the pool (aka the "kitty"): <input id="wagerAmount" type="number"><input type="button" id="makeBet" onclick="determineWager();" value="Make bet"/></label><br>
<label id="input"><input type="button" id="rollDie" onclick="onClick()" value="Roll Die"/></label>
</body>
<script>
const formatter = new Intl.NumberFormat('en-US', {
style: 'currency',
currency: 'USD',
});
var cpuDieRoll = 0, playerDieRoll = 0, diceValues = {"playerDie": {}, "cpuDie": {}}, cpuTotalScore = 0, playerTotalScore = 0, moneyPool = 0;
document.getElementById("rollDie").hidden = true;
function onClick() {
playerDieRoll = rollDie("playerDie");
cpuDieRoll = rollDie("cpuDie");
writeValue(determineScore());
document.getElementById("rollDie").hidden = true;
}
function determineWager() {
let playerWager = parseInt(document.getElementById("wagerAmount").value);
let cpuWager = 0;
let determineCpuMove = Math.trunc((Math.random() * 3));
switch (determineCpuMove) {
case 0: // Match bet
document.getElementById("wager").innerHTML = "CPU: I match your bet! 😏";
cpuWager = playerWager;
break;
case 1: // fold
document.getElementById("wager").innerHTML = "CPU: Okay, I'll fold. 😔";
playerTotal = moneyPool;
cpuWager = 0;
moneyPool = 0;
break;
case 2: // Raise bet
document.getElementById("wager").innerHTML = "CPU: I'll raise your bet! 😏";
cpuWager = (playerWager * 1.5);
break;
}
moneyPool = (cpuWager + playerWager);
document.getElementById("poolStats").innerHTML = "Pool: " + formatter.format(moneyPool);
document.getElementById("rollDie").hidden = false;
}
function printDie(dieNumber, elementId) {
let filename = "DieSet/Die" + dieNumber + ".png";
document.getElementById(elementId).innerHTML += "<image src=" + filename + ">";
//document.getElementById("wager").innerHTML = JSON.stringify(diceValues)
}
function rollDie(id) {
document.getElementById(id).innerHTML = "";
let diceTotal = 0;
for (let i = 0; i < 2; i++) {
let dieValue = Math.trunc((Math.random() * 6) + 1);
printDie(dieValue, id);
if (id === "playerDie") {
diceValues.playerDie["roll" + (i + 1)] = dieValue;
} else {
diceValues.cpuDie["roll" + (i + 1)] = dieValue;
}
diceTotal += dieValue;
}
return diceTotal;
}
function writeValue([playerRollScore, cpuRollScore]) {
document.getElementById("valueOutput").innerHTML = "Your Dice roll: " + playerRollScore + "; "
document.getElementById("valueOutput").innerHTML += "CPU Dice roll: " + cpuRollScore;
}
function determineScore() {
//Add rolls together
let playerRollScore = diceValues.playerDie["roll1"] + diceValues.playerDie["roll2"];
let cpuRollScore = diceValues.cpuDie["roll1"] + diceValues.cpuDie["roll2"];
let winString = "";
if (cpuDieRoll == playerDieRoll) {
winString = " It's a tie, no one won :("
} else {
if (playerRollScore > cpuRollScore) {
winString = " Player won!";
playerTotalScore += moneyPool;
moneyPool = 0;
} else {
winString = " CPU Won!"
cpuTotalScore = moneyPool;
moneyPool = 0;
}
}
document.getElementById("score").innerHTML = "Total Score: Player: " + formatter.format(playerTotalScore) + "; CPU: " + formatter.format(cpuTotalScore) + winString;
return [playerRollScore, cpuRollScore];
}
</script>
</html>