Coding Challenge

แชร์
ฝัง
  • เผยแพร่เมื่อ 27 พ.ค. 2024
  • 🥧 Happy Pi Day 2020! In this challenge, I build a simple web application using p5.js and node.js to search in the first billion digits of Pi. Code: thecodingtrain.com/challenges...
    🕹️ p5.js Web Editor Sketch: editor.p5js.org/codingtrain/s...
    🎥 Previous video: • Coding Challenge #155:...
    🎥 Next video: • Coding Challenge #157:...
    🎥 All videos: • Coding Challenges
    References:
    🔗 Pi Searcher: angio.net/pi/
    🔗 Peek in Pi: pi.fathom.info/
    🔗 Boyer-Moore String Search: en.wikipedia.org/wiki/Boyer%E...
    🔗 createReadStream(): nodejs.org/api/fs.html#fscrea...
    Videos:
    🎥 ES6 Arrow Function: • 16.3: ES6 Arrow Functi...
    🎥 Server-side with Node.js: • 2.1 Server-side with N...
    🎥 Working with Data and APIs track: • Working with Data and ...
    🔴 Coding Train Live 189: • Coding Train Live 189:...
    Related Coding Challenges:
    🚂 #140 Leibniz Formula for Pi: • Coding Challenge #140:...
    🚂 #161 Estimating π from Random Numbers with Euclid's Algorithm: • Coding Challenge 161: ...
    🚂 #169 Pi in the Sky Game: • Coding Challenge 169: ...
    Timestamps:
    0:00 Introduction
    2:30 Importing Pi Into p5.js
    3:37 Searching Numbers in Pi
    7:09 IndexOf Function
    13:13 Importing 1GB File
    16:38 Dividing the Data into Read Streams
    18:25 Searching 1 Billion Digits
    19:44 Creating an API
    28:42 Conclusions and Ideas
    Editing by Mathieu Blanchette
    Animations by Jason Heglund
    Music from Epidemic Sound
    🚂 Website: thecodingtrain.com/
    👾 Share Your Creation! thecodingtrain.com/guides/pas...
    🚩 Suggest Topics: github.com/CodingTrain/Sugges...
    💡 GitHub: github.com/CodingTrain
    💬 Discord: thecodingtrain.com/discord
    💖 Membership: th-cam.com/users/thecodingtrainjoin
    🛒 Store: standard.tv/codingtrain
    🖋️ Twitter: / thecodingtrain
    📸 Instagram: / the.coding.train
    🎥 Coding Challenges: • Coding Challenges
    🎥 Intro to Programming: • Start learning here!
    🔗 p5.js: p5js.org
    🔗 p5.js Web Editor: editor.p5js.org/
    🔗 Processing: processing.org
    📄 Code of Conduct: github.com/CodingTrain/Code-o...
    This description was auto-generated. If you see a problem, please open an issue: github.com/CodingTrain/thecod...
    #math #piday #nodejs #p5js #javascript

ความคิดเห็น • 182

  • @dermathze700
    @dermathze700 4 ปีที่แล้ว +235

    0:40 "A ressource where you can download all the digits of Pi."
    Wait, ALL of them? That's a very impressive website.

    • @speedfastman
      @speedfastman 4 ปีที่แล้ว +14

      The technology is finally here!

    • @MohamedSaad-zy7pu
      @MohamedSaad-zy7pu 4 ปีที่แล้ว +7

      pi has infinitely many digits no database ever could hold all digits of pi

    • @v0xl
      @v0xl 4 ปีที่แล้ว +58

      @@MohamedSaad-zy7pu woosh

    • @xnick_uy
      @xnick_uy 4 ปีที่แล้ว +53

      I can give you all the digits of pi right here in this comment: 0, 1, 2, 3, 4, 5, 6, 7, 8 and 9. Just rearrange and repeat some of them as you see fit to recreate pi. You are welcome. :-)

    • @Firestar-rm8df
      @Firestar-rm8df 4 ปีที่แล้ว +6

      @@xnick_uy XD

  • @lucasschiavetti2799
    @lucasschiavetti2799 4 ปีที่แล้ว +21

    Hey. I am just a random 30 yo Brazilian geologist switching carreers and I want to say that today is saturday night, world has corona, I am anxious, alone, thinking about life but this video and your work/passion/humour make things easier for me and I am sure for a lot of other people. Keep up the good work. We appreciate it.

    • @sombracep12
      @sombracep12 4 ปีที่แล้ว +2

      Boa Cara, muita gente de programação é de outras áreas.

  • @marcpietro2732
    @marcpietro2732 4 ปีที่แล้ว +61

    Who noticed Dan replaced so many times "million" by "billion", by deleting "million" and writing "billion" instead (or vice versa), while there is just one letter to change?

  • @Kokurorokuko
    @Kokurorokuko 4 ปีที่แล้ว +81

    28:18 Shocking news! Man found last ten digits of PI

    • @luisgeniole369
      @luisgeniole369 4 ปีที่แล้ว +2

      We can use the tail command in bash to find the last ten digits of pi like so:
      tail -c 10 pi-billion.txt

    • @kimeg7294
      @kimeg7294 4 ปีที่แล้ว +4

      "last ten digits of KNOWN PI sequence"

    • @Cry53r
      @Cry53r 4 ปีที่แล้ว +5

      @@kimeg7294 Oh... Oh no, sweet child... A billion is just the first sneeze of what has been calculated.

    • @ffggddss
      @ffggddss 4 ปีที่แล้ว

      Bigger shock - they turned out to be . . . 9876543210.
      Fred

  • @elementallobsterx
    @elementallobsterx 4 ปีที่แล้ว +27

    No way Dan... ALMOST 1 MILLION SUBSCRIBERS NOW!? I remember your classic P5 tutorials before the whole coding train thing even existed!! I just wanna say, I'm proud, man.

  • @0FG0
    @0FG0 4 ปีที่แล้ว +48

    I am always a bit amazed at how incredibly much larger a billion is than a million. I know the math is super simple, but the intuition of it is really difficult for me to grasp

    • @xot9897
      @xot9897 4 ปีที่แล้ว +10

      Morten Flecks if you look at a millimetre on a metre stick, same ratio

    • @shreerangvaidya9264
      @shreerangvaidya9264 4 ปีที่แล้ว +1

      Look back a dozen decades when the definition of billion was a million million in England, and you will be more amazed.

    • @InXLsisDeo
      @InXLsisDeo ปีที่แล้ว

      That's why people don't realize how being a billionaire is completely unnecessary and actually detrimental to society.
      See it like this: if your salary was 1 million $ per month (not per year, per month), it would take 84 years (aka more than an entire working lifetime) to earn a billion $. And that would be without spending a single $ or paying any tax during all that time.

    • @InXLsisDeo
      @InXLsisDeo ปีที่แล้ว

      @@shreerangvaidya9264 no, it's a thousand million. A million million is a trillion.

  • @097_shashanksahu6
    @097_shashanksahu6 4 ปีที่แล้ว +10

    Do everyone will ignore the fact that , coding train will soon hit 1 million subscribers. I didn't even how when you reached too close to 1M. It had been 3-4 years now since i am watching your videos.... You taught me processing, you taught me the Nature Of code.... This channel is absolute gold.... I don't remember whats the first video i watched but i could proudly say that i had watched almost every of them. 😍 love from india Dan❤

    • @thomasdevelops3087
      @thomasdevelops3087 4 ปีที่แล้ว

      shashank Sahu he has hit 1 million as of today!

  • @Budzique
    @Budzique 4 ปีที่แล้ว +31

    Pi was calculated to 50Trillion digits, a text file is available but it's 40TB! Today it's also been added to the pi.delivery api

    • @bilallaaroussi7110
      @bilallaaroussi7110 4 ปีที่แล้ว

      What is the use of this

    • @ffggddss
      @ffggddss 4 ปีที่แล้ว +3

      @@bilallaaroussi7110 Esoteric.
      It's of some interest to mathematicians to know whether there are any non-random patterns in the digits of π, and these mammoth collections of digits can be used to answer such statistical questions.
      Fred

    • @ffggddss
      @ffggddss 4 ปีที่แล้ว +3

      50 trillion digits in 40 trillion bytes? Must be slightly compressed, no? (Even if that's the binary terabyte = 2⁴⁰ B, 40 TB ≈ 44.0 trillion bytes.)
      Fred

    • @Xnoob545
      @Xnoob545 4 ปีที่แล้ว

      50T
      40TB
      Wot

    • @oblivion_2852
      @oblivion_2852 4 ปีที่แล้ว

      Use it for some good random numbers

  • @MinisBett
    @MinisBett 4 ปีที่แล้ว +13

    Finally another Coding Challenge! I really hope for more coding challenges, I really like these videos!

  • @thomasdevelops3087
    @thomasdevelops3087 4 ปีที่แล้ว +1

    Congrats on 1 millions subs! Love these challenges! I wish you a lot of luck in the future of your channel

  • @LandonHughes2
    @LandonHughes2 4 ปีที่แล้ว +2

    Ah!!! You are so close to 1 million subs!! Congrats Dan! You’ll always be the guy that made programming click for me :)

  • @zaynbaig3157
    @zaynbaig3157 4 ปีที่แล้ว +3

    Ayyyye our first coding challenge in a while! And a good one at that!

  • @debumukhopadhay541
    @debumukhopadhay541 4 ปีที่แล้ว +2

    0:00 Why, happy Pi day to you too!

  • @jAMES-xy6wh
    @jAMES-xy6wh 3 ปีที่แล้ว

    You are the best. Your energy is incredible, the world needs more like you. My wife asks what is that song you are singing? lol a man in his 50s singing coding train. THANKS!!!

  • @newzenvigor
    @newzenvigor ปีที่แล้ว

    This is my first video. I love this guy already. He makes learning coding fun. 😊

  • @Jack-cu5il
    @Jack-cu5il 4 ปีที่แล้ว +2

    Nice! I saw this suggestion on the github and was hoping you'd do it.

  • @dave6012
    @dave6012 ปีที่แล้ว

    The fact that the first million digitals is 1mb and the first billion is 1gb gives me great satisfaction.

  • @GrayBlood1331
    @GrayBlood1331 4 ปีที่แล้ว +1

    That buzz sound effect kept jump scaring me!

    • @assenv
      @assenv 4 ปีที่แล้ว

      jup the buzzer is just wrong. short conductor whistle or passing train will be much more fitting ;)

  • @KellyMurphy
    @KellyMurphy 4 ปีที่แล้ว +1

    BCD encoding the file would be 500Meg for a 1 billion digits file, not sure how much you'd get from gz or zip since pi is a high entropy number.

  • @vishalmishra1937
    @vishalmishra1937 3 ปีที่แล้ว

    this man can visualize anything

  • @giveaway4002
    @giveaway4002 4 ปีที่แล้ว +1

    waiting for this on pi day!!!!!

  • @airxperimentboom
    @airxperimentboom 3 ปีที่แล้ว

    Love it!

  • @adamwest8332
    @adamwest8332 4 ปีที่แล้ว +4

    This requires at last 1gb or RAM! Yiou should search directly from the stream, searching in chunk by chunk

  • @Nola1222Piano
    @Nola1222Piano 4 ปีที่แล้ว

    I love this!

  • @RubyPiec
    @RubyPiec 4 ปีที่แล้ว

    Cool idea!

  • @Budzique
    @Budzique 4 ปีที่แล้ว +2

    I have plenty enough file storage on my local server for 1 trillion digits (43.7GB), I may be able to set it up as a coding challenge by dumping the variables as I run out of ram and searching chunks of the file, but it would be quite a slow process.

    • @Xnoob545
      @Xnoob545 4 ปีที่แล้ว

      But shouldnt it be 1TB
      thats insane compression

    • @andrewnunes9148
      @andrewnunes9148 4 ปีที่แล้ว

      Try to use KMP algorithm and look for matchs while you read the stream

  • @hudademirtas3144
    @hudademirtas3144 4 ปีที่แล้ว +2

    Why You Dont try make a random face ganerator in processing(or you cant do that?)

  • @el_magoxd
    @el_magoxd 4 ปีที่แล้ว +3

    I promise you that I was waiting this video from 1 year ago

  • @CEBRAHULKANTWA
    @CEBRAHULKANTWA 3 ปีที่แล้ว +1

    KMP is best algorithm for me.

  • @xot9897
    @xot9897 4 ปีที่แล้ว

    Great video, youre a very engaging teacher, would you consider doing some videos on functional programming, preferably Haskell, I have trouble understanding it and there hardly any good tutorials on TH-cam

  • @jasonspence
    @jasonspence 4 ปีที่แล้ว

    It would be really neat to have the node server lazily evaluate pi as you search, until it finds the string of digits, no matter how long it takes.

  • @moussaibrahem9
    @moussaibrahem9 4 ปีที่แล้ว +6

    the video title should be *Writing Built in Javascript Function* 😂😂
    Thanks for this great video

  • @joostvanrens
    @joostvanrens 4 ปีที่แล้ว +1

    Peek in pi => pecan pie, just so it's easier to remember

  • @lucaseaston
    @lucaseaston ปีที่แล้ว

    If you substituted music notes for numbers, what would Pi sounds like? You could also see if you could find certain melodies within Pi.
    Edit: I commented this before watching till the end of the video haha.

  • @NStripleseven
    @NStripleseven 3 ปีที่แล้ว

    Can we get some more coding challenges? Maybe 3D tic-tac-toe or adding physics to your fractal trees from ages ago?

  • @mitchellpincham595
    @mitchellpincham595 4 ปีที่แล้ว +2

    What about actually calculating the first thousand or million or so digits of pi?

  • @axelmoriceau8435
    @axelmoriceau8435 4 ปีที่แล้ว

    You know things get handy when it comes to a 1GB file of plain text

  • @charliedinerman7941
    @charliedinerman7941 4 ปีที่แล้ว

    You should calculate pi in the code so you can just set a number for the number of digits you want

  • @Xiaolong-sh5tl
    @Xiaolong-sh5tl 4 ปีที่แล้ว

    I came here for Pie... but all he was talking about was PI.

  • @flamexode
    @flamexode 4 ปีที่แล้ว

    How about searching for the digit of a certain digit in pi? Could be an interesting recursive function

  • @ryan-heath
    @ryan-heath 4 ปีที่แล้ว

    You could speed it up by a factor of 4 by instead of search for chars, search for longs (that is 4 chars at once). Caveat is that your search string should be at least 4 chars ...
    Even faster would be keeping track of where all digits are, that would speed it up by factor of ten, but you would use 10 times more memory.
    Performance tuning is always a trade-off for something else 😬

    • @TheCodingTrain
      @TheCodingTrain  4 ปีที่แล้ว

      Thanks for these suggestions!

    • @agcummings11
      @agcummings11 4 ปีที่แล้ว

      The computer would still have to compare the sane number of bits, so it isn’t really a 4x speed up

    • @ryan-heath
      @ryan-heath 4 ปีที่แล้ว

      See it like this: compare 12 bytes or compare 3 longs.
      The amount of bits is the same but the CPU can do it in less instructions, thus faster.

  • @avi12
    @avi12 4 ปีที่แล้ว

    10:04 If the condition ends up being true, you can just return -1 instead of keeping track of a variable "found"

    • @Justinba1010
      @Justinba1010 4 ปีที่แล้ว

      You can't do so, you need to exhaustively search the entire string. Say you're looking for 1419, U would go 1 4 1, then 5, but you cannot exit there.

  • @surendrasandun
    @surendrasandun 4 ปีที่แล้ว

    I love pi day challange😍

  • @basilbaby2069
    @basilbaby2069 4 ปีที่แล้ว

    Close to 1 million subscribers ♥️♥️

  • @prabhatkumar8173
    @prabhatkumar8173 ปีที่แล้ว

    Hi can make programe which can read the chart provided by a website on the screen and create signals on activity detected !?

  • @delta619
    @delta619 4 ปีที่แล้ว +3

    what if i +j will exceed the length of the text file , when the value of i is at last , or somewhere in the last

    • @luisgeniole369
      @luisgeniole369 4 ปีที่แล้ว +1

      27:56 We can use the tail command in bash to cat the last ten digits like so:
      tail -c 10 pi-billion.txt

    • @delta619
      @delta619 4 ปีที่แล้ว

      Brent Trenholme i thought it may give an exception something like out of bounds.

    • @delta619
      @delta619 4 ปีที่แล้ว +1

      Brent Trenholme yeah 😄, thnx

    • @TheCodingTrain
      @TheCodingTrain  4 ปีที่แล้ว

      indeed, i should have accounted for this!

    • @delta619
      @delta619 4 ปีที่แล้ว

      The Coding Train i need coding train sticker for my laptop if i may ask. 🥺 Fan from India

  • @qwertygmr4521
    @qwertygmr4521 4 ปีที่แล้ว +8

    Well, here In Spain we write the date in different order, so it is 14/3/20. Which is pretty sad 😞😞

    • @leo848
      @leo848 4 ปีที่แล้ว +2

      Qwerty GMR Same in Europe

    • @cosminturtureanu692
      @cosminturtureanu692 4 ปีที่แล้ว +2

      @@leo848 Spain is in Europe

    • @cosminturtureanu692
      @cosminturtureanu692 4 ปีที่แล้ว +2

      @@HiHi-ur3on oh yeah.. i forgot it just moved

    • @cosminturtureanu692
      @cosminturtureanu692 4 ปีที่แล้ว +2

      @@HiHi-ur3on yeah.. after all, you should eat your cereal

    • @leo848
      @leo848 4 ปีที่แล้ว +1

      Cosmin Cosmin I meant holy Europe

  • @thenormalguy8574
    @thenormalguy8574 2 ปีที่แล้ว

    hey dan! i am trying to implement this to my express server which holds projects, but it seems like the app.use overrides the front page (which is "/"). can anyone help me?

  • @silentgrove7670
    @silentgrove7670 4 ปีที่แล้ว

    Is there a pi inside pi
    find 3
    then 31
    then 314
    then 3141
    I wonder what that sequence would look like ?

  • @purifierphoenixthemecca2074
    @purifierphoenixthemecca2074 4 ปีที่แล้ว

    Bailey-Borwein-Plouffe formula

  • @olasoderlind5685
    @olasoderlind5685 4 ปีที่แล้ว

    is there a Prossesing Server ?

  • @angshu7589
    @angshu7589 4 ปีที่แล้ว

    All your videos are so great and so entertaining. Oh and:
    function askQuestion(question, sender) {
    if ( typeof question !== "string" && typeof sender !== "string" ) {
    return "The question and sender is not a proper one";
    }
    if (question == "Any ideas for another video?" && sender == "David Shiffman") {
    return {
    getTheIdea: function() {
    console.log("Put the code to run this console.log as a reply");
    }
    dumpIdea: function() {
    try {
    this.getTheIdea = null;
    } catch (e) {
    console.error("getTheIdea Cannot be deleted");
    }
    }
    }
    }
    return "Sorry, No answer here...";
    }

  • @zulnabilfaizmoh.alhadad8729
    @zulnabilfaizmoh.alhadad8729 4 ปีที่แล้ว

    Sir, I like how you deliver content about machine learning. I really want good people like you to contribute in the fight against corona virus. I have an idea, what if you create content about the neural network chatbot. I think this is useful for socialization about corona virus to the public. Some doctors say, prevention is the best medicine for all diseases. The socialization of preventing corona virus at this time is the most needed thing to suppress the virus spread.
    Thanks, i hope you at least read this.

  • @InXLsisDeo
    @InXLsisDeo ปีที่แล้ว

    No need for a bigger file. The natural challenge here is to compute the digits themselves. But I guess it requires a bit of mathematics.

  • @SimonTiger
    @SimonTiger 4 ปีที่แล้ว

    Code simplification:
    let start = search.charAt(0);
    for (let i = 0; i < txt.length; i++) {
    if (txt.charAt(i) === start) {
    let found = true;
    for (let j = 1; j < search.length; j++) {
    if (txt.charAt(i + j)) !== search.charAt(j) {
    found = false;
    break;
    }
    }
    if (found) {
    return i;
    }
    }
    }
    return -1;
    is the same as
    for (let i = 0; i < txt.length; i++) {
    if (txt.charAt(i) === search.charAt(0)) {
    let found = true;
    for (let j = 1; j < search.length; j++) {
    if (txt.charAt(i + j)) !== search.charAt(j) {
    found = false;
    break;
    }
    }
    if (found) {
    return i;
    }
    }
    }
    return -1;
    is the same as
    for (let i = 0; i < txt.length; i++) {
    let found = true;
    for (let j = 0; j < search.length; j++) {
    if (txt.charAt(i + j)) !== search.charAt(j) {
    found = false;
    break;
    }
    }
    if (found) {
    return i;
    }
    }
    return -1;

  • @techsupport3227
    @techsupport3227 3 ปีที่แล้ว

    Do you know any other code languages other than java script? I learned the bare minimum of java script and now I’m learning html to create a website for my friend

  • @CyCloNeReactorCore
    @CyCloNeReactorCore 4 ปีที่แล้ว

    What program is he using?

  • @haris621
    @haris621 4 ปีที่แล้ว

    After 1 billion you would need to use algorithms similar to sorting algorithms.

  • @adrianshawuk
    @adrianshawuk 4 ปีที่แล้ว

    You must do Tau Day too

  • @necaton
    @necaton 4 ปีที่แล้ว +1

    Happy Pi day!

  • @Julian-xe5is
    @Julian-xe5is 3 ปีที่แล้ว

    wasn't pi supposed to be a non-repeating and non-terminating decimal number? there are repeating numbers in this video though (such as ....99999....)?

  • @John-qx1xn
    @John-qx1xn 4 ปีที่แล้ว

    Or, in two minutes but with no error checking but including time to download file:
    import sys
    target = sys.argv[1]
    data = open('onemeg.dat').read()
    pos = data.find(target)
    if pos < 0:
    print '{} not found'.format(target)
    else:
    print '{}: {} {}'.format(pos, target, data[pos+len(target):pos+41])

  • @XallbX
    @XallbX 4 ปีที่แล้ว

    Make a Picross solver.

  • @davidcullingford5708
    @davidcullingford5708 3 ปีที่แล้ว

    double value=sqrt(2.0);
    println(value); // prints many decimal places.
    text(value, 100,100); gets an error.

  • @bensmart2829
    @bensmart2829 4 ปีที่แล้ว

    He even included inside in the title

  • @mikewonghongkee4480
    @mikewonghongkee4480 4 ปีที่แล้ว +1

    Happy 🥧 day🤓

  • @dekanex
    @dekanex 4 ปีที่แล้ว

    Why number 3 is not in?

  • @Jack-yz6yp
    @Jack-yz6yp 4 ปีที่แล้ว

    1 mill!!

  • @leo848
    @leo848 4 ปีที่แล้ว +9

    I forgot it was pi day...
    SHAME ON ME

    • @levinsondsouza
      @levinsondsouza 4 ปีที่แล้ว

      you are pi pi poo poo

    • @RubyPiec
      @RubyPiec 4 ปีที่แล้ว +1

      @@levinsondsouza pie pie?

  • @nonono8108
    @nonono8108 4 ปีที่แล้ว +1

    Oh, do you have a new character?

  • @BGhoshPikaPikachu
    @BGhoshPikaPikachu 4 ปีที่แล้ว

    Happy Gilfoyle

  • @iradnuriel9087
    @iradnuriel9087 4 ปีที่แล้ว

    You could implement kmp algorithm, this algorithm is not so hard to implement...

  • @farhannr28
    @farhannr28 4 ปีที่แล้ว +3

    Damm i even still haven't moved on since the last pi day special

  • @DannySullivanMusic
    @DannySullivanMusic 4 ปีที่แล้ว +2

    This certainly has been an interesting year so far...

  • @bencekovacs8726
    @bencekovacs8726 4 ปีที่แล้ว

    You are supposed to use pattern matching for this problem, and not for loops..

    • @lucasg.5534
      @lucasg.5534 2 ปีที่แล้ว

      you are supposed to shut up

  • @sujatapanigrahy7172
    @sujatapanigrahy7172 3 ปีที่แล้ว

    Im gonna make this in python

  • @sirynka
    @sirynka 4 ปีที่แล้ว

    Isn't it as easy as pressing ctrl+f inside a pi.txt file?

  • @shurmurray
    @shurmurray 4 ปีที่แล้ว

    But 1 million digits of Pi file should weight only about 2 megs - in 2020 it is nothing even for JS. It is very small amount of memory.
    And, well, 1 billion is about 2 gigs, depends on encoding.

  • @thomasdevelops3087
    @thomasdevelops3087 4 ปีที่แล้ว +1

    When is 1 trillion coming haha

  • @hakankosebas2085
    @hakankosebas2085 4 ปีที่แล้ว

    Make plastic deformation simulation

  • @xxxxxijhin
    @xxxxxijhin 4 ปีที่แล้ว

    NINE
    NINE
    NINE
    NINE
    NINE
    NINE

  • @milothegoat280
    @milothegoat280 4 ปีที่แล้ว

    9:40 is he writing on the wall with a sharpie??

    • @TheCodingTrain
      @TheCodingTrain  4 ปีที่แล้ว

      don't worry it's a dry erase whiteboard

  • @SquooshyShark1000
    @SquooshyShark1000 4 ปีที่แล้ว +2

    15:07 it's not binary, it's hexadecimal I know that because I do Unicode stuff every now and then

    • @Justinba1010
      @Justinba1010 4 ปีที่แล้ว

      They're interchangeable in this context. It is just outputted as hexadecimal, it is technically a binary, usually buffers are binary data. What does unicode have to do with this anyway?

  • @danielzaiser
    @danielzaiser 4 ปีที่แล้ว

    what the hell dude, why you gotta do me like that?
    At 0:59 your buzzer sounds exactly like my door bell and i went outside to check if anybody just rang...
    *EDIT:* and he keeps using that buzzing sound throughout the video....

  • @ZK-im6er
    @ZK-im6er 4 ปีที่แล้ว

    Is it maybe fun, to find self indexing numbers in the first billion numbers of Pi? So like 3.1415(edit) 1 would be index 1 and thus be its own index. Or maybe if 1 would index 0.
    I got the idea from this Numberphile video about looping numbers in Pi( starting with a given number, finding its index, than looking at that numbers it index and so on)
    Here is the video th-cam.com/video/W20aT14t8Pw/w-d-xo.html

  • @JambaYCS
    @JambaYCS 4 ปีที่แล้ว

    i was in chat during the stream :))

  • @flolow.4990
    @flolow.4990 4 ปีที่แล้ว +2

    Here is the code for Processing(Java):
    String raw[];
    String digits;
    String surch = "";
    void preload() {
    raw = loadStrings("pi.txt");
    }
    void setup() {
    size(500, 500);
    preload();
    digits = raw[0];
    }
    void draw() {
    background(0);
    suchBox();
    int index = digits.indexOf(surch);
    fill(0, 100, 255);
    text(index - 1, width/2, height/1.5);
    }
    void keyPressed() {
    if (keyCode == BACKSPACE) {
    surch = "";
    } else {
    surch += key;
    }
    }
    void suchBox() {
    rectMode(CENTER);
    textAlign(CENTER, CENTER);
    fill(255);
    stroke(0);
    rect(width/2, height/2, width/2, height/8);
    fill(0);
    textSize(20);
    text(surch, width/2, height/2);
    }

  • @manuelesparza5321
    @manuelesparza5321 4 ปีที่แล้ว +1

    dude literally i had this idea like a week ago to publish it today (pieandme.com)

  • @origedit
    @origedit 4 ปีที่แล้ว

    Peeing inside Pik -_-

  • @chadwickhjones
    @chadwickhjones 4 ปีที่แล้ว

    Pi day should be 14% through the month of March, not the 14th day of March.

  • @wt030
    @wt030 4 ปีที่แล้ว

    Great video, but this annoing sound when you correct yourself...

  •  4 ปีที่แล้ว

    Game made with p5.js: spaceadvent.glitch.me/

  • @pascha4527
    @pascha4527 4 ปีที่แล้ว +1

    10:00 txt.charAt(int) at line 17 could overflow.....

  • @Xnoob545
    @Xnoob545 4 ปีที่แล้ว +1

    Do 1 trillion

  • @jakobus5098
    @jakobus5098 4 ปีที่แล้ว

    grep

  • @grainfrizz
    @grainfrizz 4 ปีที่แล้ว

    This is O(N²)

    • @amey7064
      @amey7064 4 ปีที่แล้ว +1

      It's actually pretty close to theta(n), since the length of the sequence to be searched is small relative to s billion digits

    • @ryan-heath
      @ryan-heath 4 ปีที่แล้ว

      I think the big o is still O(N)
      It would be O(N^2) when your search string would be always as big as the digits of PI

  • @zfoell
    @zfoell 4 ปีที่แล้ว +1

    Suggestion for the editor: have music playing in the background and increase the volume of the music when showing a fast forwarded lapse of Dan working through code, rather than having the music cut in and out

  • @andrewqi6695
    @andrewqi6695 4 ปีที่แล้ว

    7th

  • @ebentee
    @ebentee 4 ปีที่แล้ว +7

    Whoever read this, you'll be successful one day. Let's do this for the future

  • @kieranwalker2249
    @kieranwalker2249 4 ปีที่แล้ว

    Pi = 22➗7