LMU ☀️ CMSI 185
COMPUTER PROGRAMMING
HOMEWORK #2 PARTIAL ANSWERS

Writing Problems

  1. Answers vary, of course. As long as you show breadth in the computing field, you should be okay.
  2. Alan Turing is considered the founder of the field of computer science because he:
    • Formalized the concept of computation. That is, he showed that computations themselves could be represented as mathematical objects capable of being rigorously analyzed and studied.
    • Showed (mathematically) that a single machine that capable of executing any intuitively computable operation could be built . This concept led directly to the stored-program computer, whose impact on the world is hard to overestimate. Think about it: one single machine could simulate any other machine. Prior to Turing, machines were special-purpose. Today we know that we can program a single computer to do practically anything.

    He did a of other things too, but the question asked for things that he did that made him be considered the founder of a new field. The Turing Test and work on ACE and work in decryption were nice, but they did not create a new field of study.

  3. Before answering this question, make sure you understand the article! The author of the article, John Tierney, was discussing a work of Nick Bostrom, author of the Simulation Argument, who said that one of the following must be true:
    1. No intelligent civilization lasts long enough to create simulations with conscious simulated beings.
    2. Intelligent civilizations that develop the power to create such simulations choose not to run them.
    3. If created, such simulations will be of such a number, and of such sizes, that the number of simulated beings far surpasses the number of actual (biological) ancestors of the simulation creators. Therefore the likelihood that a given conscious being is simulated (as opposed to residing the base reality) is near certain.

    Now the question you were asked to answer was: what exactly is the argument (or arguments) that we do indeed live in a simulation? In other words, how would you argue that condition is (iii) is true while (i) and (ii) are false? Here’s what was said:

    We are living in a world where the computing power to build high-fidelity ancestor simulations is perhaps only decades away. We know pretty much what they would look like, so they are going to happen. Furthermore, human nature is such that we would never hold back our curiosity or power by outlawing the building of these simulations. Therefore, these simulations will be built.

    Now, are there other arguments not mentioned in the article? Well, yes, strictly speaking, the article never quite proposed the following:

    In a large enough universe, anything goes, so there is a near-certain probability that a civilization would arise that could build a high-fidelity universe simulation, in which conscious beings could evolve to write their own universe simulations, whose inhabitants would write their own simulations. And so on and so on and so on. In this case, there are a near infinite number of simulated universes and only one real one, so the chance of a consicious entity not being simulated is pretty close to zero.

    Now what are the arguments against us living in a simulation? They are in the article! If you accept Bostrom’s argument, then simply argue that (i) high-fidelity ancestor simulations require more time to create than the lifespan of intelligent life on any planet, or (ii) no society in their right mind would ever do such a thing even if they had the power. You can also pick on item (iii) itself and say “no society would ever create a big enough simulation for sims to outnumber the biologicals.”

    Showing that (i) is the true case might be the easiest to do, using the argument that there is no evidence consciousness can arise from pure computation. After all, Bostrom, in his original paper, did a little bit of hand-waving asking us to accept “a certain quite widely accepted position in the philosophy of mind.”

    Here are articles against the universe being a simulation:

    Bostrom wrote a response to Brueckner.

    As for whether it even matters that we live in a simulation or not, two things apply. First, if you want to come back for another run of the simulation, lead an interesting (if not moral) life. Second, we wouldn’t really care that it is a simulation, because our experiences are real to us.

    calamitiessupernatural.png

  4. Here are ten structually ambiguous sentences that I found. You may of course have others.
    • Lawyers give poor free advice. (“poor“ could be a noun or adjective.)
    • Teacher strikes idle kids. (“strikes“ could be a noun or a verb.)
    • Seven foot doctors sue hospital. (“seven“ could modify either “foot“ or “doctors.“)
    • Stolen painting found by tree. (The tree could be the one doing the finding or just a place.)
    • Enraged cow injures farmer with ax. (The ax could have been possessed by the cow or the farmer.)
    • Two sisters reuinited after 18 years at checkout counter. (“18 years“ may or may not apply to “at checkout counter“.)
    • The train left the station crowded and dirty. (“crowded“ could modify either “train“ or “station.“)
    • Landmine claims dog arms company. (“dog“ could be a noun or a verb.)
    • Hershey bars protest. (“bars“ could be a noun or a verb.)
    • They cooked for the first time on the stove. (“cooked“ could refer to “They“ or unmentioned food.)
  5. Larry Tesler theorized (most likely correctly!) that the complexity of modes were barriers to people becoming comforatble with computers even after weeks of training and use. It’s annoying when pressing the W key sometimes makes a W appear on the screen and sometimes does something completely different. How can one remember what happens when? Without modes, every action does the same thing every time.
  6. Here are some characteristics of planners and bricoleurs from the Turkle and Papert paper.
    PlannersBricolouers
    • Are rule-driven
    • Approach knowledge and programming top-down, from the abstract to the concrete
    • Use modules to dissect problem into parts and make parts fit into whole solution
    • Value hierarchy and abstraction
    • View mistakes as missteps
    • Value algorithmic, structured, plan-oriented, abstract thinking
    • Do not feel comfortable until construct is black-boxed
    • Write their own programs opaquely but prefer to dissect programs made by others to understand them
    • Look to universal principles when making decisions
    • Construct theories through arranging and negotiation with well-known material
    • Approach knowledge and programming bottom-up, from the concrete to the abstract
    • Prefer mastery of associations and interactions
    • Gain knowledge through exploring different effects, finding which ones are pleasurable
    • Start with one idea, associate and connect to others rather than having an outline
    • Gradually modifies programs
    • Are open to renegotiating forms
    • Write their own programs transparently but prefer to interact with programs made by others
    • Can appear more decisive through their explorations
    • Better at “faking it”
    • Consider concrete situations when making decisions
    • Place self in space of objects (tangible, sensuous, tactile), imagine what it is like to be a component
    • See things in terms of relationships rather than properties (relational thinking)

Programming Problems

  1. Here is the JavaScript for live tripling of a string within a web application, assuming the text box has id input and the HTML element to output the result is called output:
    const inputBox = document.querySelector('#input')
    const outputSpan = document.querySelector('#output')
    
    inputBox.addEventListener('input', showRepeatedMessage)
    
    function showRepeatedMessage() {
      outputSpan.textContent = inputBox.value.repeat(3)
    }
    
  2. Here’s the JavaScript that computes the hexadecimal equivalent for a decimal integer in a web application:
    const inputBox = document.querySelector('#input')
    const outputSpan = document.querySelector('#output')
    
    inputBox.addEventListener('input', showHex)
    
    function showHex() {
      outputSpan.textContent = Number(inputBox.value).toString(16)
    }
    
  3. For the days-between-dates script, we have to turns the strings from the box into date objects, subtract them to get milliseconds, then convert the milliseconds into days:
    const fromBox = document.querySelector('#startDate')
    const toBox = document.querySelector('#endDate')
    const outputSpan = document.querySelector('#output')
    
    fromBox.addEventListener('input', showDayDifference)
    toBox.addEventListener('input', showDayDifference)
    
    function showDayDifference() {
      const MILLISECONDS_PER_DAY = 24 * 60 * 60 * 1000
      const fromDate = new Date(fromBox.value)
      const toDate = new Date(toBox.value)
      const days = (toDate - fromDate) / MILLISECONDS_PER_DAY
      outputSpan.textContent = `Days between: ${days}`
    }