Computer engines that play Mancala
Engines that play Mangala?
What is the simplest way (least error-prone, least lines of code, however you want to interpret it) to open a file in C and read its contents into a string (char*, char[], whatever)? As far as I know, the variance inflation factor is not computed with pseudo-$R^{2}$ or generalized $R^{2}$ in binary outcome models (e.g. logistic regression).  Are there other measures of multi-colinearity than VIF appropriate to such models?  Why ought or ought not we think about multi-colinearity in such models? How to get the current time in Python How to prove or disprove statements about sets Prove or disprove:  The set: $\{ \emptyset\}^{\Bbb N}$ has only one element.  The set $\emptyset^{\Bbb N}$ is empty.    I'm pretty sure both are true, for 1. all the natural numbers go to the empty set and that is the only element. Where as 2. all the natural numbers go to nothing so that's why it's empty. (Same as $ {\Bbb N}^{\emptyset} $ nothing goes to something is nothing (I think)). The problem is I have no idea how to show this so advice would be appreciated.  Edit: My defintion of a function is: $f:B\to A$ if  $(a_1,b),(a_2,b)\in f \ \Rightarrow \ a_1=a_2$ So for 2. I can simply say that: $(1,\emptyset),(2,\emptyset)\in f \Rightarrow a_1\neq a_2$  ? Completion handlers and return values Version: Ubuntu 16.04  I have used it some weeks, but now it gives me this message when I'm trying to install software and update or upgrade:  Could not get lock /var/lib/apt/lists/lock - open (11: Resource temporarily unavailable) /var/lib/apt/lists/ locked   followed by this:    .  and another error:  ** (appstreamcli:4560): WARNING **: Exception: Unable to get write lock on /var/cache/app-info/xapian/default: already locked   What should I do? cin and getline skipping input I'm talking about this nonsense:   Now, I'm aware that there are problems with the practicalities (or possibilities) of methods involving exotic matter with negative mass, and that kind of thing has been addressed here:   But in this case my question is different and more specific. Sweeping all the other problems of constructing such a beast under the rug, wouldn't this violate causality?  SR says that the simultaneity and relative ordering of events is dependent on the relative motion of the observer, but that no matter how it works out, if event A causes event B, no observer will see B first. One of the many problems with FTL travel (or signals) is that if any information is sent faster than light, there will exist an inertial frame in which the signal arrives before it is sent, a blatant violation of causality. (I think we can all agree, can we not, that the threshold should be extremely high before breaking assumptions that we're in a causal universe?)  So how is any scheme to travel faster than light, even if it may locally satisfy the equations of GR, not a blatant violation causality according to SR?  Is my understanding of GR incomplete and there's something in it that obviates the causality implications of SR? Or am I correct that FTL claims should be dismissed with extreme prejudice on this basis alone? (Pending a serious replicable experiment showing causality to be breakable.) I have seen many examples of how to render sprites from a spritesheet but I havent grasped why it is the most common way of dealing with sprites in 2d games.  I have started out with 2d sprite rendering in the few demo applications I've made by dealing with each animation frame for any given sprite type as its own texture - and this collection of textures is stored in a dictionary. This seems to work for me, and suits my workflow pretty well, as I tend to make my animations as gif/mng files and then extract the frames to individual pngs.  Is there a noticeable performance advantage to rendering from a single sheet rather than from individual textures? With modern hardware that is capable of drawing millions of polygons to the screen a hundred times a second, does it even matter for my 2d games which just deal with a few dozen 50x100px rectangles?  The implementation details of loading a texture into graphics memory and displaying it in XNA seems pretty abstracted. All I know is that textures are bound to the graphics device when they are loaded, then during the game loop, the textures get rendered in batches. So it's not clear to me whether my choice affects performance.  I suspect that there are some very good reasons most 2d game developers seem to be using them, I just don't understand why. How can I list the contents of a .zip folder in c#? How can I list the contents of a zipped folder in C#? For example how to know how many items are contained within a zipped folder, and what is their name? How to vertically align an image inside a div This is just a curiosity. I have come across multiple proofs of the fact that there are infinitely many primes, some of them were quite trivial, but some others were really, really fancy. I'll show you what proofs I have and I'd like to know more because I think it's cool to see that something can be proved in so many different ways.  Proof 1 : Euclid's. If there are finitely many primes then $p_1 p_2 ... p_n + 1$ is coprime to all of these guys. This is the basic idea in most proofs : generate a number coprime to all previous primes.  Proof 2 : Consider the sequence $a_n = 2^{2^n} + 1$. We have that  $$ 2^{2^n}-1 = (2^{2^1} - 1) \prod_{m=1}^{n-1} (2^{2^m}+1), $$  so that for $m &lt; n$, $(2^{2^m} + 1, 2^{2^n} + 1) \, | \, (2^{2^n}-1, 2^{2^n} +1) = 1$. Since we have an infinite sequence of numbers coprime in pairs, at least one prime number must divide each one of them and they are all distinct primes, thus giving an infinity of them.  Proof 3 : (Note : I particularly like this one.) Define a topology on $\mathbb Z$ in the following way : a set $\mathscr N$ of integers is said to be open if for every $n \in \mathscr N$ there is an arithmetic progression $\mathscr A$ such that $n \in \mathscr A \subseteq \mathscr N$. This can easily be proven to define a topology on $\mathbb Z$. Note that under this topology arithmetic progressions are open and closed. Supposing there are finitely many primes, notice that this means that the set $$ \mathscr U \,\,\,\, \overset{def}{=} \,\,\, \bigcup_{p} \,\, p \mathbb Z $$ should be open and closed, but by the fundamental theorem of arithmetic, its complement in $\mathbb Z$ is the set $\{ -1, 1 \}$, which is not open, thus giving a contradiction.   Proof 4 : Let $a,b$ be coprime integers and $c &gt; 0$. There exists $x$ such that $(a+bx, c) = 1$. To see this, choose $x$ such that $a+bx \not\equiv 0 \, \mathrm{mod}$ $p_i$ for all primes $p_i$ dividing $c$. If $a \equiv 0 \, \mathrm{mod}$ $p_i$, since $a$ and $b$ are coprime, $b$ has an inverse mod $p_i$, call it $\overline{b}$. Choosing $x \equiv \overline{b} \, \mathrm{mod}$ $p_i$, you are done. If $a \not\equiv 0 \, \mathrm{mod}$ $p_i$, then choosing $x \equiv 0 \, \mathrm{mod}$ $p_i$ works fine. Find $x$ using the Chinese Remainder Theorem.   Now assuming there are finitely many primes, let $c$ be the product of all of them. Our construction generates an integer coprime to $c$, giving a contradiction to the fundamental theorem of arithmetic.  Proof 5 : Dirichlet's theorem on arithmetic progressions (just so that you not bring it up as an example...)  Do you have any other nice proofs? Why can my keyboard only digest 6 keypresses at a time? When I slam my hand onto my keyboard, only a maximum of 6 keys will be registered, I've tested this for the past few minutes and was unable to get more than 6. Is this the same on all keyboards? If not, what would be the distinguishing factor, If yes: why 6 specifically?  For clarification: I do not have a usecase for this, I am simply curious What is the result of $ \lim_{n \to \infty} \frac{ \sum^n_{i=1} i^k}{n^{k+1}},\ k \in \mathbb{R} $ and why? What is the result of the next limit:   $$ \lim_{n \to \infty} \frac{ \sum^n_{i=1} i^k}{n^{k+1}},\ k \in \mathbb{R} $$  Why (theorem)? Is the product of two non-holomorphic function always non-holomorphic? Suppose $h(z)$ is a complex function. I have noticed that $h(z) = f(z)\cdot g(z)$, where $f(z)$ and $g(z)$ are non-holomorphic. Can $h(z)$ be holomorphic?   Can a similar statement be made, if $f(z)$ is holomorphic, but $g(z)$ is not? A site URL changed and now its icon in SEDE is broken When is the Killing form null? When is the Killing form $\kappa$ of a Lie algebra $\mathfrak g$ null, i.e. $\kappa(\cdot,\cdot)=0$? Surely this is true for any Lie algebra with trivial bracket, but is this the only case? I can't seem to find any nontrivial examples. Why the galaxies form 2D planes (or spiral-like) instead of 3D balls (or spherical-like)? Question: As we know, (1) the macroscopic spatial dimension of our universe is 3 dimension, and (2) gravity attracts massive objects together and the gravitational force is isotropic without directional preferences. Why do we have the spiral 2D plane-like Galaxy(galaxies), instead of spherical or elliptic-like galaxies?   Input: Gravity is (at least, seems to be) isotropic from its force law (Newtonian gravity). It should show no directional preferences from the form of force vector $\vec{F}=\frac{GM(r_1)m(r_2)}{(\vec{r_1}-\vec{r_2})^2} \hat{r_{12}}$. The Einstein gravity also does not show directional dependence at least microscopically.  If the gravity attracts massive objects together isotropically, and the macroscopic space dimension is 3-dimensional, it seems to be natural to have a spherical shape of massive objects gather together. Such as the globular clusters, or GC, are roughly spherical groupings , as shown in the Wiki picture:     However, my impression is that, even if we have observed some more spherical or more-ball-like , it is more common to find more-planar  such as our ? (Is this statement correct? Let me know if I am wrong.)  Also, such have a look at this more-planar Spiral "galaxy" as this NGC 4414 galaxy:    Is there some physics or math theory explains why the  turns out to be planar-like (or spiral-like) instead of spherical-like?  See also a   p.s. Other than the classical stability of a 2D plane perpendicular to a classical angular momentum, is there an interpretation in terms of the quantum theory of vortices in a macroscopic manner (just my personal speculation)?  Thank you for your comments/answers! A single row background colour Is there are rule when to use opened vs open?  I always get confused even though I've been speaking English as the dominant language for more than half my life.  E.g.         Is the door open(ed)?   Which file do you have open(ed) in your editor?