[ ] Individual should show that they were key contributor and example to team. This includes their participation in ideas, plans, creating individual issues, providing code commits to project, crossover grading participation, being on task and positive example in the classroom.
Individuals Video, Issue(s), Commits(s)
[ ] Video, includes Web demo of key contribution to project, 1 minute
[ ] Issue(s) that show plans/progress to team objectives
[ ] Highlights of key commit(s) in Issues, summarizes code contributions
[ ] Review GitHub analytics for key commits in each weeks during the project, shows consistent participation for 3 weeks
Per check.
0.55 not attempted/no check
0.7 attempted, incoomplete, but some runtime
0.8 mastery and runtime
0.9 above and beyond.
Freeform comment.
Provide positivies and growth summary.
Justify or comment on final score.
Be sure to provide extra details on anything below 0.7 average or above 0.8.
JS Code:
// fibonacci-art.js
const canvas = document.getElementById('fibCanvas');
const ctx = canvas.getContext('2d');
function fibonacciBinet(n) {
const phi = (1 + Math.sqrt(5)) / 2; // Golden ratio
const sqrt5 = Math.sqrt(5);
const fibN = Math.round((Math.pow(phi, n) - Math.pow(1 - phi, n)) / sqrt5);
return fibN;
}
function generateArt() {
const startTime = performance.now();
ctx.clearRect(0, 0, canvas.width, canvas.height);
const method = Math.random(); // Randomly choose a method
let generationTime;
if (method < 0.25) {
displayFibMethod('recursive');
generateRecursiveArt();
} else if (method < 0.5) {
displayFibMethod('Binet formula');
generateRecursiveArtWithBinet(20);
} else if (method < 0.75) {
displayFibMethod('iterative');
generateIterativeArt();
generationTime = performance.now() - startTime;
} else {
displayFibMethod('matrix');
generateMatrixArt();
generationTime = performance.now() - startTime;
}
if (!generationTime) {
generationTime = performance.now() - startTime;
}
displayGenerationTime(generationTime);
}
function drawCircle(x, y, radius) {
ctx.beginPath();
ctx.arc(x, y, radius 5, 0, Math.PI 2);
ctx.fillStyle = hsl(${Math.random() * 360}, 70%, 50%);
ctx.fill();
}
function displayFibMethod(method) {
const fibMethodElement = document.getElementById('fibMethod');
fibMethodElement.textContent = Fibonacci Method Used: ${method};
const numElement = document.getElementById('number');
numElement.textContent = Number: 20;
}
function displayGenerationTime(time) {
const generationTimeElement = document.getElementById('generationTime');
generationTimeElement.textContent = Generation Time: ${time.toFixed(2)} milliseconds;
}
function generateRecursiveArtWithBinet(maxIterations) {
const centerX = canvas.width / 2;
const centerY = canvas.height / 1;
recursiveDrawWithBinet(centerX, centerY - 350, 0.5, maxIterations, 0);
}
function fibonacciBinet(n) {
return Math.round(
(1 / Math.sqrt(5))
(Math.pow((1 + Math.sqrt(5)) / 2, n) - Math.pow((1 - Math.sqrt(5)) / 2, n))
);
}
function recursiveDrawWithBinet(x, y, size, remainingIterations, angle) {
if (remainingIterations > 0) {
ctx.beginPath();
ctx.arc(x, y, size 3.2, 0, Math.PI 2);
ctx.fillStyle = `hsl(${Math.random() 360}, 70%, 50%)`;// Adjust color based on size and iteration
ctx.fill();
const newSize = fibonacciBinet(remainingIterations); // Use Binet formula for size
const nextX = x + size 0.05 Math.cos(angle); // Adjust x-position based on angle
const nextY = y + size 0.05 Math.sin(angle); // Adjust y-position based on angle
const newAngle = angle + Math.PI / 3; // Increment angle for each iteration
recursiveDrawWithBinet(nextX, nextY, newSize 0.3, remainingIterations - 1, newAngle);
}
}
// Matrix
function power(matrix, n) {
let result = [[1, 0], [0, 1]];
while (n > 0) {
if (n % 2 === 1) {
result = multiplyMatrices(result, matrix);
}
matrix = multiplyMatrices(matrix, matrix);
n = Math.floor(n / 2);
}
return result;
}
function multiplyMatrices(matrix1, matrix2) {
let result = [];
for (let i = 0; i < matrix1.length; i++) {
result[i] = [];
for (let j = 0; j < matrix2[0].length; j++) {
let sum = 0;
for (let k = 0; k < matrix1[0].length; k++) {
sum += matrix1[i][k] matrix2[k][j];
}
result[i][j] = sum;
}
}
return result;
}
function fibonacciMatrix(n) {
const baseMatrix = [[1, 1], [1, 0]];
if (n === 0) return 0;
const result = power(baseMatrix, n - 1);
return result[0][0];
}
function generateMatrixArt() {
const centerX = canvas.width / 2;
const centerY = canvas.height / 2;
let a = 0, b = 1;
let angle = 0;
const scale = 12; // Adjust scaling factor
for (let i = 0; i < 20; i++) { // Adjust iterations as needed
const fibNumber = fibonacciMatrix(i); // Generate Fibonacci number using matrix method
const radius = fibNumber scale;
// Calculate position based on polar coordinates
const x = centerX + radius 0.5 Math.cos(angle);
const y = centerY + radius 0.5* Math.sin(angle);
drawCircle(x, y, fibNumber);
// Update angle for the next circle placement
angle += Math.PI / 2; // You can experiment with different angles
}
}
Backend
Created Fibonacci API with two methods
golden ratio method
public class goldenRatio extends Fibo {
public static ArrayList findNth(int num) {
if (num <= 0) {
throw new IllegalArgumentException("Input must be a positive integer");
}
ArrayList<Integer> fibonacciList = new ArrayList<>();
fibonacciList.add(0);
fibonacciList.add(1);
for (int i = 2; i <= num; i++) {
int fib = fibonacciList.get(i - 1) + fibonacciList.get(i - 2);
fibonacciList.add(fib);
}
return fibonacciList;
}
}
public class binetFormula extends Fibo {
public static ArrayList calculateFibonacci(int num) {
if (num <= 0) {
throw new IllegalArgumentException("Input must be a positive integer");
}
ArrayList<Integer> fibonacciList = new ArrayList<>();
double sqrt5 = Math.sqrt(5);
double phi = (1 + sqrt5) / 2;
for (int i = 0; i <= num; i++) {
int fib = (int) Math.round((Math.pow(phi, i) - Math.pow(-phi, -i)) / sqrt5);
fibonacciList.add(fib);
}
return fibonacciList;
}
Individual Review "My name" grading "Their name"
Individuals Video, Issue(s), Commits(s)
[ ] Review GitHub analytics for key commits in each weeks during the project, shows consistent participation for 3 weeks
Per check.
0.55 not attempted/no check 0.7 attempted, incoomplete, but some runtime 0.8 mastery and runtime 0.9 above and beyond.
Freeform comment.
Provide positivies and growth summary.
Justify or comment on final score.
Be sure to provide extra details on anything below 0.7 average or above 0.8.
Video
Key Commits
JS Code: // fibonacci-art.js const canvas = document.getElementById('fibCanvas'); const ctx = canvas.getContext('2d'); function fibonacciBinet(n) { const phi = (1 + Math.sqrt(5)) / 2; // Golden ratio const sqrt5 = Math.sqrt(5); const fibN = Math.round((Math.pow(phi, n) - Math.pow(1 - phi, n)) / sqrt5); return fibN; } function generateArt() { const startTime = performance.now(); ctx.clearRect(0, 0, canvas.width, canvas.height); const method = Math.random(); // Randomly choose a method let generationTime; if (method < 0.25) { displayFibMethod('recursive'); generateRecursiveArt(); } else if (method < 0.5) { displayFibMethod('Binet formula'); generateRecursiveArtWithBinet(20); } else if (method < 0.75) { displayFibMethod('iterative'); generateIterativeArt(); generationTime = performance.now() - startTime; } else { displayFibMethod('matrix'); generateMatrixArt(); generationTime = performance.now() - startTime; } if (!generationTime) { generationTime = performance.now() - startTime; } displayGenerationTime(generationTime); } function drawCircle(x, y, radius) { ctx.beginPath(); ctx.arc(x, y, radius 5, 0, Math.PI 2); ctx.fillStyle =
hsl(${Math.random() * 360}, 70%, 50%)
; ctx.fill(); } function displayFibMethod(method) { const fibMethodElement = document.getElementById('fibMethod'); fibMethodElement.textContent =Fibonacci Method Used: ${method}
; const numElement = document.getElementById('number'); numElement.textContent =Number: 20
; } function displayGenerationTime(time) { const generationTimeElement = document.getElementById('generationTime'); generationTimeElement.textContent =Generation Time: ${time.toFixed(2)} milliseconds
; } function generateRecursiveArtWithBinet(maxIterations) { const centerX = canvas.width / 2; const centerY = canvas.height / 1; recursiveDrawWithBinet(centerX, centerY - 350, 0.5, maxIterations, 0); } function fibonacciBinet(n) { return Math.round( (1 / Math.sqrt(5)) (Math.pow((1 + Math.sqrt(5)) / 2, n) - Math.pow((1 - Math.sqrt(5)) / 2, n)) ); } function recursiveDrawWithBinet(x, y, size, remainingIterations, angle) { if (remainingIterations > 0) { ctx.beginPath(); ctx.arc(x, y, size 3.2, 0, Math.PI 2); ctx.fillStyle = `hsl(${Math.random() 360}, 70%, 50%)`;// Adjust color based on size and iteration ctx.fill(); const newSize = fibonacciBinet(remainingIterations); // Use Binet formula for size const nextX = x + size 0.05 Math.cos(angle); // Adjust x-position based on angle const nextY = y + size 0.05 Math.sin(angle); // Adjust y-position based on angle const newAngle = angle + Math.PI / 3; // Increment angle for each iteration recursiveDrawWithBinet(nextX, nextY, newSize 0.3, remainingIterations - 1, newAngle); } } // Matrix function power(matrix, n) { let result = [[1, 0], [0, 1]]; while (n > 0) { if (n % 2 === 1) { result = multiplyMatrices(result, matrix); } matrix = multiplyMatrices(matrix, matrix); n = Math.floor(n / 2); } return result; } function multiplyMatrices(matrix1, matrix2) { let result = []; for (let i = 0; i < matrix1.length; i++) { result[i] = []; for (let j = 0; j < matrix2[0].length; j++) { let sum = 0; for (let k = 0; k < matrix1[0].length; k++) { sum += matrix1[i][k] matrix2[k][j]; } result[i][j] = sum; } } return result; } function fibonacciMatrix(n) { const baseMatrix = [[1, 1], [1, 0]]; if (n === 0) return 0; const result = power(baseMatrix, n - 1); return result[0][0]; } function generateMatrixArt() { const centerX = canvas.width / 2; const centerY = canvas.height / 2; let a = 0, b = 1; let angle = 0; const scale = 12; // Adjust scaling factor for (let i = 0; i < 20; i++) { // Adjust iterations as needed const fibNumber = fibonacciMatrix(i); // Generate Fibonacci number using matrix method const radius = fibNumber scale; // Calculate position based on polar coordinates const x = centerX + radius 0.5 Math.cos(angle); const y = centerY + radius 0.5* Math.sin(angle); drawCircle(x, y, fibNumber); // Update angle for the next circle placement angle += Math.PI / 2; // You can experiment with different angles } } Backend Created Fibonacci API with two methodsgolden ratio method public class goldenRatio extends Fibo { public static ArrayList findNth(int num) {
if (num <= 0) {
throw new IllegalArgumentException("Input must be a positive integer");
}
}
public class binetFormula extends Fibo { public static ArrayList calculateFibonacci(int num) {
if (num <= 0) {
throw new IllegalArgumentException("Input must be a positive integer");
}
}