# Is every $\mathbb{I}$-compact topological space compact?

Let $\mathbb{I}$ denote the unit interval. Call a topological space $X$ $\mathbb{I}$-compact iff every continuous function $f : X \rightarrow \mathbb{I}$ attains its maximum at some point in $X$.

Question. Is every $\mathbb{I}$-compact topological space compact?

We can replace $\mathbb{I}$ with either of $[0,\infty]$ and/or $[-\infty,\infty]$, of course, without changing the meaning of the above definition.

If $X$ is $\mathbb{I}$-compact then $X$ must be pseudocompact. This can be seen by a contrapositive: suppose $X$ is not pseudocompact. Then there is a continuous unbounded function $f: X \to \mathbb{R}$. We can assume that $f[X] \subseteq [1,\infty)$ WLOG. But then $1-\frac{1}{f} : X \to [0,1]$ is also continuous and does not assume its supremum $1$, so $X$ is not $\mathbb{I}$-compact..
Reversely, every pseudocompact space is $\mathbb{I}$-compact, as a continuous image of a pseudocompact space is pseudocompact, and in metric spaces pseudocompactness is equivalent to compactness and compact subsets of $[0,1]$ have a maximum. (this is true in any ordered space.)
So the answer is no for e.g. $X= \omega_1$ in the order topology. There are many more examples of non-compact pseudocompact spaces, like Mrówka's $\Psi$ space, $\Sigma$-products of uncountably many copies of $[0,1]$ etc.
So I think that $X$ $\mathbb{I}$-compact is just equivalent to pseudocompactness of $X$. So it is equivalent to compactness in the realm of metric spaces, e.g.