“The computer programmer is a creator of universes for which he alone is the lawgiver. No playwright, no stage director, no emperor, however powerful, has ever exercised such absolute authority to arrange a stage or field of battle and to command such unswervingly dutiful actors or troops.” — Joseph Weizenbaum In the early 2010’s 1 when I was taking an undergrad course on Logic Programming, there…
“In the end, we must imagine the authentic engineer happy; not because they have conquered the corporate machine, but because they have refused to let it conquer them. Each day they choose, once again, to be skillfully human in an environment designed to make them efficiently mechanical. This choice, repeated daily in small acts of professional integrity, is both our burden and our freedom.” —…
A niven number is a non-negative number that is divisible by the sum of its digits. Write a function/method named niven , which prints all the niven numbers from 0 to 100 inclusive. Being in quarantine during the SARS-CoV-2 outbreak is having a massive impact on our everyday lives, particularly in our physical and mental health. It seems one is always working, without any notion of the passage of…
So, yesterday, my friend and PhD student JP Dias , decided to send me this .eml file 1 (I’ll just put a snippet here; you can download the file using the provided link): Delivered-To: steg@gmail.com Received: by 2002:a67:f6da:0:0:0:0:0 with SMTP id v26csp64869vso; Fri, 7 Jun 2019 03:57:36 -0700 (PDT) Date: Fri, 07 Jun 2019 11:57:33 +0100 Message-ID:…
The first principle is that you must not fool yourself – and you are the easiest person to fool. — Richard Feynman This story begins early in 2018 as I was trying to wrap my head around Javascript’s (in particular, NodeJS) Event Loop . A single threaded universe Most modern (as well as old) languages provide an apparatus for the developer to manage the multi-core, multi-processing machinery at our…
Bisca (a Portuguese version of the Italian game Bríscola ) is a trick-taking card game usually played by 2 players with the common 52-card French deck, but with the 8, 9 and 10’s of each suite removed, thus creating a 40-card deck. The main objective is to accumulate more points than the opponent, based on the cards that are captured and forfeited. There are several variations to this game; the…
Consider a unitary, 100-dimensional, hyper-sphere. What proportion of its volume lies within the last 0.01 of its radius? It’s an odd question, no doubt; a 100-dimensional hyper-sphere, whatever that is. But there’s a moral to this puzzle that will become evident if we do baby steps: Let’s dumb this down… Imagine instead that we wanted to tackle the following simplified version: Consider a unitary…
100 prisoners are imprisoned in solitary cells. Each cell is windowless and soundproof (i.e., there’s absolutely no way to exchange information among them once they are imprisoned). There’s a central room with one light bulb; the bulb is initially off. No prisoner can see the light bulb from his or her own cell. Each day, the warden picks a prisoner equally at random, and that prisoner visits the…
Let $a_0, a_1, a_2, …$ be a sequence of integers, where $a_{m+n} + a_{m-n} = ½(a_{2m}+a_{2n})$. If $a_1 = 1$, what would be the value of $a_{1997}$? 1 The first thing one should do when trying to tackle something like this is to “check out the terrain” . I would be very tempted to write a computer program to find the values for me right away, but where should the program start from, considering…
Below you can find some examples on correctness checking and derivation through calculation of simple programs. These exercises are part of the Formal Methods in Software Engineering course given at the Masters in Informatics Engineering at the Faculty of Engineering, University of Porto . Find the Weakest Precondition of the following: 1.1. $\{wp\}$ b:=c+1; a:=c+2 $\{c<b ∧ b<a\}$ $wp($ b:=c+1 ,…