monke7769 / copy1

hayden chen
https://monke7769.github.io/copy1/
MIT License
0 stars 0 forks source link

Review Ticket Tri 2 Binary Project #9

Open monke7769 opened 7 months ago

monke7769 commented 7 months ago

Key Commits

commit 1

Issue faced: Pressing the buttons did not update the decimal values of the R, G, and for the colors.

Fix: Create function buttonClicked() to handle the event that user presses button. Add the power of two if it's 0 to 1, and subtraction the button goes from 1 to 0.

Second issue faced: the 2^0 button added/subtracted 2^8

Second Fix: The math function used was not correctly handling this case. Instead of just taking mod 8 of the button number and subtracting it from 8, it should be subtracting button number from 8, taking mod 8, adding 8 in the case it being negative (since mod of a negative number in JS is negative) and take modulo 8 again. This is shown on this line: val.innerHTML = String(parseInt(val.innerHTML) + Math.floor(2**((((8-buttonNumber)%8)+8)%8))); where the value of the decimal number is increased if a button is clicked to go from 0 to 1. A similar solution (- instead of +) was implemented for updating if the button goes from 1 to 0.

commit 2 (Note: the commit name is off because my computer was about to die)

Issue faced: The buttons didn't change the box colors when pressed. console.log() did not work at this point because the CSS broke it somehow.

Fix: Realized that the new variables being created for the R, G, B values of the color box were being parsed as binary when they were in fact just decimal: var r1 = parseInt(document.getElementById("num1").innerHTML, 2);

deleted the , 2 at the end of the parseInt to change into var r1 = parseInt(document.getElementById("num1").innerHTML);

This was a key commit because of simply how hard it was to debug the site without the console.log() utility available for troubleshooting.

These two key commits demonstrate my contribution to the Colors AND portion of the project, including the CSS and JS skills gathered along the way. Without these commits, Colors AND would not be functional at all, it would just be an array of 48 buttons and 3 big black boxes. The Colors AND project is a user-friendly visual representation of binary to decimal conversion as well as a display of RGB colors and represents my learning and usage of jQuery and CSS through the first few weeks of this trimester.

monke7769 commented 7 months ago

Individual Review [__] grading Hayden Chen

Individuals Video, Issue(s), Commits(s)