This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
State,Income,Language,Family Size,Date | |
Texas,148283,Spanish,6,4/19/2024 | |
Florida,115424,Spanish,3,5/27/2024 | |
Florida,124234,English,1,2/21/2024 | |
Massachusetts,138321,Spanish,6,12/13/2023 | |
Idaho,119133,English,4,5/7/2024 | |
Michigan,103318,Spanish,5,4/22/2024 | |
Arizona,95597,English,4,10/12/2024 | |
Missouri,83248,English,5,5/1/2024 | |
Washington,83672,Spanish,3,4/25/2024 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
State | Income | Family Size | Language | |
---|---|---|---|---|
California | 58000 | 4 | English | |
Texas | 45000 | 5 | Spanish | |
New York | 67000 | 3 | English | |
Florida | 38000 | 6 | Spanish | |
Illinois | 72000 | 2 | English | |
Arizona | 41000 | 4 | Spanish | |
Nevada | 50000 | 3 | English | |
New Mexico | 34000 | 5 | Spanish | |
Oregon | 60000 | 2 | English |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name,size,gender,email,age | |
Alexis Coleman,medium,Male,[email protected],28 | |
Susan Warren,small,Male,[email protected],25 | |
Joshua Kim,large,Female,[email protected],32 | |
Michael Garrett,small,Male,[email protected],27 | |
Andre Smith,small,Female,[email protected],24 | |
Pamela Calderon,small,Female,[email protected],30 | |
Annette Arroyo,medium,Female,[email protected],29 | |
Lynn Mcgrath,small,Female,[email protected],22 | |
Susan Middleton,large,Male,[email protected],31 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CREATE TABLE employees ( | |
employee_id SERIAL PRIMARY KEY, | |
name VARCHAR(100), | |
email VARCHAR(100), | |
salary DECIMAL(10, 2), | |
bonus DECIMAL(10, 2), | |
department VARCHAR(50) | |
); | |
-- Insert data into employees |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CREATE TABLE Buildings (Building_name VARCHAR(2) PRIMARY KEY, Capacity INTEGER); | |
CREATE TABLE Employees (Role TEXT, Name TEXT, Building VARCHAR(2), Years_employed SMALLINT, FOREIGN KEY (Building) | |
REFERENCES Buildings(Building_name)); | |
INSERT INTO Buildings VALUES | |
('1e', 24), ('1w', 32), ('2e', 16), ('2w', 20); | |
INSERT INTO Employees VALUES | |
('Engineer', 'Becky A.', '1e', 4), | |
('Engineer', 'Dan B.', '1e', 2), | |
('Engineer', 'Sharon F.', '1e', 6), |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Car { | |
constructor(outerDi, innerDi, screenHt, screenWd, carDi, obsts) { | |
this.x = | |
0.5 * (screenWd - (innerDi + outerDi) / 2) + round(random() * 80) - 40; // Slight variation in starting x | |
this.y = screenHt / 2 - 5; // Right above the starting line | |
this.angle = -PI / 2; // Facing upward | |
//Dimensions for later usage | |
this.carDi = carDi; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<head> | |
<!-- Load in Tensorflow, P5, and our Car Class--> | |
<script src="https://cdn.jsdelivr.net/npm/@tensorflow/[email protected]/dist/tf.min.js"></script> | |
<script | |
src="https://cdnjs.cloudflare.com/ajax/libs/p5.js/1.1.9/p5.min.js" | |
integrity="sha512-WIklPM6qPCIp6d3fSSr90j+1unQHUOoWDS4sdTiR8gxUTnyZ8S2Mr8e10sKKJ/bhJgpAa/qG068RDkg6fIlNFA==" | |
crossorigin="anonymous" | |
></script> | |
<script src="car.js"></script> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function startNewGen() { | |
totalFitness = endGen(); | |
let newCarArr = []; // The next generation | |
mutationRate = mrateInput.value() // Pull mutation rate | |
//Get parent weights | |
let parentWeights = []; | |
cars.forEach((c) => { | |
parentWeights.push(c.copyWeights()); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
frameCount += 1; | |
// If 200 frames has passed plus a scaled of the highestScore, then start next generation | |
if (frameCount > 200 + topFitnessScore * 3) { | |
startNewGen(); | |
frameCount = 0; | |
} else if (frameCount > 80) { // Check for inactivity after 80 frames | |
let stillActive = false; | |
// Make sure atleast one car has made progress without dying | |
cars.forEach((car) => { | |
if (car.fitness > 3 && car.dead == false) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function startNewGen() { | |
totalFitness = endGen(); | |
let newCarArr = []; // The next generation | |
//Get parent weights | |
let parentWeights = []; | |
cars.forEach((c) => { | |
parentWeights.push(c.copyWeights()); | |
}); |
NewerOlder