Coding Challenge

  Рет қаралды 36,721

The Coding Train

The Coding Train

Күн бұрын

Пікірлер: 109
@gntlmnwzrd
@gntlmnwzrd 6 жыл бұрын
Dan I've been watching your playlist on processing, and I just wanted to say I'm a big fan of your videos and teaching style. YOU ARE THE REASON I'm passing my intro to computer science class. I have now become an avid fan of yours, and will continue to promote your videos and content. Keep up being you, you have made learning this stuff for me fun!
@cringy7-year-old5
@cringy7-year-old5 6 жыл бұрын
You’re so much better a coding than me that when you were failing at base conversions, something that’s pretty easy in my opinion, I laughed.
@chaitanyasingh8620
@chaitanyasingh8620 3 жыл бұрын
I was so absorbed in your video that I actually sat for like half an hour. BTW Amazing videos, love it.
@ivannhup8508
@ivannhup8508 6 жыл бұрын
Base 8 is octal which is often used in representing access to files in read (r) , write (w)or execute (x) permission
@melongoggles8385
@melongoggles8385 6 жыл бұрын
Honestly. My teacher taught me about binary, decimal and hexadecimal at school. But it was really boring to sit through. I got it in the end but after watching this video i wish my teacher was like you. I mean, lets be honest. This is a pretty boring subject to talk about... but you still somehow manage to make it into a fun and pleasing to watch video while also teaching people about this stuff. Thank you dan!
@ehawkins730
@ehawkins730 6 жыл бұрын
I just completed my own "challenge" of making the Binary Clock based on your tutorial (in Swift)! Thank you for everything and your time exposing us to these techniques!
@TheCodingTrain
@TheCodingTrain 6 жыл бұрын
Amazing! Did you share a link on the website? github.com/CodingTrain/website/wiki/Community-Contributions-Guide
@ehawkins730
@ehawkins730 6 жыл бұрын
The Coding Train thank you for the comment and encouraging, sir! I posted on Twitter, but I will clean it up and add it to the Github! Thank you for everything!
@loyal0713
@loyal0713 6 жыл бұрын
this.state = 1 - this.state Simple toggle between 1 and 0
@TheCodingTrain
@TheCodingTrain 6 жыл бұрын
Indeed, thank you!!
@thetastefultoastie6077
@thetastefultoastie6077 6 жыл бұрын
You can also this.state ^= 1 to avoid writing the variable name twice
@Remls
@Remls 6 жыл бұрын
"to avoid writing the variable name twice" oh god the horror
@loyal0713
@loyal0713 6 жыл бұрын
Can't say I knew about that notation, thanks
@thetastefultoastie6077
@thetastefultoastie6077 6 жыл бұрын
+Adam Raaif Nasheed not writing the variable twice makes the code more readable, less prone to error and easier to refactor. it's not a huge deal as most editors these days have tools/autocomplete that do these for you but IMHO it's still better
@GF3R
@GF3R 6 жыл бұрын
Love your channel :D i work as a dev and from time to time we have kids, interested in computer science, at work. And I love using p5js and your fun ideas to give them a first insight into coding. Obviously i also recommend your channel to them ;)
@TheCodingTrain
@TheCodingTrain 6 жыл бұрын
So nice, thank you!
@ev4_gaming
@ev4_gaming 5 жыл бұрын
This is cool! i recently made a converter from any base to any other base on my TI-84
@rpanda_old
@rpanda_old 6 жыл бұрын
Brother you deserve more subscribers. Your channel is wonderful. Love from India😍
@aakashkumrawat3509
@aakashkumrawat3509 6 жыл бұрын
I am also from. #india
@Holobrine
@Holobrine 6 жыл бұрын
Hexadecimal conversion from binary is extremely easy and simple. 16 = 2^4, so every 4 bits corresponds to one hex digit, and which hex digit that is is simply the number in those 4 bits.
@justgame5508
@justgame5508 6 жыл бұрын
You can tell most of the programmers who watch you work with high level/abstract programming languages, bitwise operations are used all the time in C and C++, especially if your working with hardware and communicating with individual registers/memory locations
@TrebleWing
@TrebleWing 5 жыл бұрын
Loving seeing the bitwise stuff honestly. I code assembly for the 6502 in my hobby time so binary and hex are kinda the only way to get anything done. lol
@garrethutchington1663
@garrethutchington1663 3 жыл бұрын
Shouldn't you be multiplying by pow(2, bytes.length - 1 - i); the same index you use to retrieve the bit value?
@Laysyv
@Laysyv 6 жыл бұрын
Wow, I had this homework in highschool! :))
@DJW489
@DJW489 4 жыл бұрын
This guy is awesome
@shervilgupta92
@shervilgupta92 6 жыл бұрын
Successfully completed it :D, thank you for the idea.
@jiminapemode5873
@jiminapemode5873 6 жыл бұрын
Watched this live.. going to watch it again anyway 😎 epic
@DigitalMonsters
@DigitalMonsters 6 жыл бұрын
There's probably a hundred easier ways but this is what I scratched out anway. function bin_to_dec(binary) { if (binary.match(/[^0-1]/)) return undefined; return binary.split("").reverse().map(Number) .reduce((dec, bit, index) => dec += Math.pow(2, index) * bit, 0); }
@eugenetswong
@eugenetswong 2 жыл бұрын
Thanks!
@NerveClasp
@NerveClasp 6 жыл бұрын
I get that this is for those, who only start learning JS, but wouldn't it be cool to introduce some of the ES6 syntax gradually? Otherwise we'll have a lot of new people, who speak Latin =) Here's my quick take on the function that would convert binary to decimal: `const binaryToDecimal = binaryString => binaryString.split('').reverse().reduce((sum, char, i) => sum + Math.pow(2, parseInt(char)), 0)`
@NerveClasp
@NerveClasp 6 жыл бұрын
where `const binaryToDecimal = binaryString => ` is the same as ``` function binaryToDecimal( binaryString ) { return ... } ``` `binaryString.split('')` (those are two single quote marks in brakets) splits a string and makes an array aout of it, which allows us to use all the goodies like 'map', 'forEach', 'filter', 'reduce'.. reduce takes a function (a reducer) which in turn gets the accumulator as the first parameter, here I call it 'sum', second parameter is each element in an array one-by-one, optional `i` is the iterator from the for loop you've used. second reduce parameter is the initial value for the accumulator (`sum` in my case). Again, the reduce part can be rewritten as: ``` .reduce( function( sum, char, i ) { return sum + Math.pow(2, parseInt(char)); }, 0) ``` So instead of all those `function` and `return` and `for (i=0; i binaryString .split('') .reverse() .reduce((sum, char, i) => sum + Math.pow(2, parseInt(char)), 0)
@haripal369
@haripal369 Жыл бұрын
Call me back later when you come to office or exercise English page number 92 aur yah bhi theek hai to mere se baat kar rahi hai mujhe bhi participate kiya hai aur iska class nahi hai aap ka homework kara dena main bhi participate kiya hai aap ke sath se baat simriderde hai aur iska class work bhi nahi karungi aap sabhi ko Tulsi
@NerveClasp
@NerveClasp Жыл бұрын
@@haripal369 I believe I blocked your number
@NerveClasp
@NerveClasp Жыл бұрын
@@haripal369 waaaaaait, Prime, is that you?) I hope not, otherwise this would be the most pathetic comeback ever))
@twist84
@twist84 6 жыл бұрын
Ayy I watched this live, twas fun.
@koordszz
@koordszz 4 жыл бұрын
I like the way this guy thinks. I'm a huuuge fan. PS: Shame on those you skips his ads.
@vulturebeast
@vulturebeast 6 жыл бұрын
Respect for you , you're my motivation bro literally love your work 💖
@deadxaim
@deadxaim 3 жыл бұрын
You're pretty great.
@chavezraul6879
@chavezraul6879 6 жыл бұрын
Guys, I love this channel, I respect and admire Daniel Shiffman and my passion is programming. I really hate to have to do this and is not my intention to do spam, but I really need help with a processing issue. When I try to add a library, a mode or a tool, I can't and a pink error windows message shows saying "Could not connect to the processing server". I've been looking for a solution to that problem, unsuccessfully. I hope to find an answer in this fabulous community, I'd really appreciate it. Thank you!
@TheCodingTrain
@TheCodingTrain 6 жыл бұрын
Thanks for the question! This error would usually be because of an internet connectivity issue or firewall blocking Processing. Try asking at discourse.processing.org/ it's a better place for questions!
@chavezraul6879
@chavezraul6879 6 жыл бұрын
@@TheCodingTrain Thank you very much! I finally got a solution. I deleted every single folder of processing files, uninstalling it completely and reinstalling it again. That finally worked. I had tried to reinstall it before, but didn't work, probably because I didn't uninstall it this deep. P.S.: You are my coding inspiration!
@sitaramshramachetan5423
@sitaramshramachetan5423 6 жыл бұрын
Hey can tell me how to code in java a program by which I am able to draw mathematical curves like you equals x square
@tcocaine
@tcocaine 6 жыл бұрын
Processing works, I'm sure Java also have official support for DirectX and/or OpenGL
@sitaramshramachetan5423
@sitaramshramachetan5423 6 жыл бұрын
Thank you!
@gldanoob3639
@gldanoob3639 6 жыл бұрын
This is pretty easy to do. How about decimal to binary instead???
@clipsus_clips
@clipsus_clips 6 жыл бұрын
I was really waiting for the ternary operator :)
@landonanderson7015
@landonanderson7015 6 жыл бұрын
Oh hi
@clipsus_clips
@clipsus_clips 6 жыл бұрын
Hello there
@canaDavid1
@canaDavid1 6 жыл бұрын
Trinary
@zeref783
@zeref783 6 жыл бұрын
Is parseInt working for hex(16)?
@MalakaiProgrammer
@MalakaiProgrammer 6 жыл бұрын
I see James Veitch in your recommended :eyes: I like James Veitch :eyes:
@ahmedbadal3795
@ahmedbadal3795 6 жыл бұрын
you look awesome today
@davidbale8495
@davidbale8495 6 жыл бұрын
8 bits = 1 byte. 4 bits = 1 nybble, 2 bits = $.25
@eris4734
@eris4734 6 жыл бұрын
2 bits =0.25 2 bitcoins = 3000 coin = 12000
@DowzerWTP72
@DowzerWTP72 6 жыл бұрын
var binaryString = "1001101"; var decimalInt = 0; for (var b=0; b
@Holobrine
@Holobrine 6 жыл бұрын
Never count to four in binary with your fingers.
@Xnoob545
@Xnoob545 5 жыл бұрын
Because f😞k
@SimonTiger
@SimonTiger 5 жыл бұрын
I mean, just count up to 1024 with your fingers: www.mathsisfun.com/numbers/binary-count-fingers.html
@milestailsprower4555
@milestailsprower4555 2 жыл бұрын
Long PREMIERE EVER!
@niklaskoskinen123
@niklaskoskinen123 6 жыл бұрын
I think the title is a bit misleading. What you're doing here is most certainly not converting binary to decimal but rather only parsing binary strings to integers (which are still binary). The conversion only happens when the result is automaticlly converted to a decimal string for rendering. I was expecting a conversion from integer to binary coded decimal since that would've been more appropriate when working seven segment displays.
@TheCodingTrain
@TheCodingTrain 6 жыл бұрын
Good point! The idea was to start here and eventually make it to explaining the conversion in the 7 segment display but I got sidetracked, oops. Thanks for the feedback.
@niklaskoskinen123
@niklaskoskinen123 6 жыл бұрын
@@TheCodingTrain Thanks for the response. Hope you get to doing the bcd conversion some time in the future.
@DowzerWTP72
@DowzerWTP72 6 жыл бұрын
#include #include using namespace std; string binaryString = "0110010"; int decimalOut = 0; int main() { for (int b=0; b
@Haha007
@Haha007 6 жыл бұрын
Hmmm is this gonna be boring addition or some funky binary to bcd using double dabble? I think that would make a funny challenge. ;p
@hasancakir8932
@hasancakir8932 6 жыл бұрын
coding challenge 119: back to the cs101 :)
@antonf.9278
@antonf.9278 6 жыл бұрын
More and more youtubers find out about this feature
@hingedelephant
@hingedelephant 6 жыл бұрын
Anton Funk And more and more KZbin viewers despise this feature.
@KnakuanaRka
@KnakuanaRka 6 жыл бұрын
Dave Messer Yeah, what’s the point of it? All I see is it teasing you with notifications about it before it actually shows.
@noeldiaz1354
@noeldiaz1354 6 жыл бұрын
you should have a section in your website, where people can submit or link there p5 code, it will be cool to see what people do with this type of challenges
@TheCodingTrain
@TheCodingTrain 6 жыл бұрын
I do! More info here: github.com/CodingTrain/website/wiki/Community-Contributions-Guide
@kshetrasahu8151
@kshetrasahu8151 4 жыл бұрын
I tied to solve #119 binary number into decimal please solve any one.......
@alexsandergutierrezgoncalves
@alexsandergutierrezgoncalves 6 жыл бұрын
Hello, I love your videos, I could make a video of raycast implementation in pure javascript.
@Engineer9736
@Engineer9736 6 жыл бұрын
128 64 32 16 8 4 2 1 On every spot where there is a 1, add this value to the total sum. Tada, stream not needed anymore 😏
@MrDevianceh
@MrDevianceh 6 жыл бұрын
var bintodec = str => !(str.match(/^[10]+$/g))?'not binary':str.split('').reverse().map(x=>Number(x)).map((a,b)=>!a?0:(b==0)?1:Array(b).fill(2).reduce((y,z)=>y*z)).reduce((q,e)=>q+e) not the pretties of one liners but i like it
@minijimi
@minijimi 6 жыл бұрын
bin2dec(input){ let len = 7; let counter=0; let pos[]; let letter1; let letter2; let letter3; let letter4; let letter5; let letter6; let letter7; letter0=input[0]; letter1=input[1]; letter2=input[2]; letter3=input[3]; letter4=input[4]; letter5=input[5]; letter6=input[6]; letter7=input[7]; pos[0]=1; pos[1]=2; pos[2]=4; pos[3]=8; pos[4]=16; pos[5]=32; pos[6]=64; pos[7]=128; let currentChecker; let decimal; currentChecker=0; if(letter0=='1' && currentChecker==0 && currentChecker
@multiapples6215
@multiapples6215 6 жыл бұрын
minijimi You could probably condense that down to a few lines with some for loops “lööps”
@hingedelephant
@hingedelephant 6 жыл бұрын
minijimi Python def bin2dec(numstr): decimal_value = 0 for i, v in enumerate(reversed(numstr)): decimal_value += (2 ** i) * int(v) return decimal_value
@Engineer9736
@Engineer9736 6 жыл бұрын
Php:
@hingedelephant
@hingedelephant 6 жыл бұрын
Another premiere? Another video in my feed I’m less likely to watch.
@TheCodingTrain
@TheCodingTrain 6 жыл бұрын
Thanks for the feedback, this is the first time I'm trying premieres, I will see how it goes and evaluate if/when/how to use it in the future.
@KnakuanaRka
@KnakuanaRka 6 жыл бұрын
It wouldn’t turn me away from watching it, but I do agree all it seems to do is tease us with notifications when we can’t actually watch it yet. What is the point?
@CaelVK
@CaelVK 6 жыл бұрын
please do things in processing again
@hirnlager
@hirnlager 6 жыл бұрын
/*hex to dec*/ 0xff/1 // 255
@sql64
@sql64 6 жыл бұрын
binary number / 5
@michaelscofield2652
@michaelscofield2652 6 жыл бұрын
Inefficient asf
@haripal369
@haripal369 Жыл бұрын
Hi. Sir
@I35UM
@I35UM 6 жыл бұрын
Its the sum of each digit times the place. Elemantary.
@gurgelgurka1489
@gurgelgurka1489 6 жыл бұрын
not first
@theukuleleist
@theukuleleist 6 жыл бұрын
oh great more of this premiere crap getting sick of videos showing up that are not even watchable yet
@soensaid
@soensaid 6 жыл бұрын
paul smith it’s not that deep
@TheCodingTrain
@TheCodingTrain 6 жыл бұрын
Thanks for the feedback, this is the first time I'm trying premieres, I will see how it goes and evaluate if/when/how to use it in the future.
@Kersplat
@Kersplat 6 жыл бұрын
There's not a way for me to disable Premier Notification on my Android app, so I am not a fan of the notification feature. I do watch all of your videos, even live!
@hingedelephant
@hingedelephant 6 жыл бұрын
The Coding Train So... what’s the verdict?
@truth884
@truth884 6 жыл бұрын
Dude
@zyada9334
@zyada9334 6 жыл бұрын
Can you make half life 3 using any coding language ?
Coding Challenge #120: Bit Shifting
17:52
The Coding Train
Рет қаралды 44 М.
Coding Challenge 183: Paper Marbling Algorithm
32:10
The Coding Train
Рет қаралды 82 М.
Cat mode and a glass of water #family #humor #fun
00:22
Kotiki_Z
Рет қаралды 42 МЛН
AI Is Making You An Illiterate Programmer
27:22
ThePrimeTime
Рет қаралды 303 М.
A Proof That The Square Root of Two Is Irrational
17:22
D!NG
Рет қаралды 7 МЛН
Apple ][ Coding Challenge: Fractal Tree
35:35
The Coding Train
Рет қаралды 387 М.
Can I Solve This Unsolved Math Problem?
16:21
CodeParade
Рет қаралды 293 М.
Coding Challenge 182: Apollonian Gasket Fractal
56:48
The Coding Train
Рет қаралды 90 М.
Collisions Without a Physics Library! (Coding Challenge 184)
31:05
The Coding Train
Рет қаралды 140 М.
The man from Kerala who can make any Perfume!
5:17
Nencib Community
Рет қаралды 7 МЛН
Coding Challenge #126: Toothpicks
31:13
The Coding Train
Рет қаралды 84 М.
Hacking a weird TV censoring device
20:59
Ben Eater
Рет қаралды 3,4 МЛН