ref: 4ad0040d6f005cc87df6d91cd126317f7a1331f2
parent: 61ff1f6dff36379a89ebba09c2466afea43317f4
author: phil9 <telephil9@gmail.com>
date: Sun Jan 16 08:24:09 EST 2022
start a new game when pressing enter if current game is finished
--- a/nordle.c
+++ b/nordle.c
@@ -205,7 +205,7 @@
if(tried[i] == 0)
continue;
c = tried[i] == 1 ? NONE : RPOS;
- s[0] = toupper(i + 'a');
+ s[0] = 'A' + i;
p = stringnbg(screen, p, cols[TEXT], ZP, kfont, s, 1, cols[c], ZP);
p.x += 4;
j += 1;
@@ -247,8 +247,13 @@
if(k == Kdel)
threadexitsall(nil);
- if(done)
+ if(done){
+ if(k == '\n'){
+ newgame();
+ redraw();
+ }
return;
+ }
if(lcount < 4 && 'a' <= k && k <= 'z'){
lines[++lcount][lnum] = (char)k;
redraw();