Une TUI pour jouer au go - retour accueil
git clone git://bebou.netlib.re/go-tui
Log | Files | Refs |
commit e15f3ac6f0e84f7b34a4b93c9f2c0906384e4796 parent b20082cb36c7fa98345413d86eaf208b406e9d95 Auteurice: Arthur Pons <arthur.pons@unistra.fr> Date: Tue, 15 Jul 2025 17:31:46 +0200 On peut supprimer des pierres Mais ça fait popper des pierres en haut à gauche de nul part trop bizarre Diffstat:
M | gotui.c | | | 11 | +++++++++-- |
1 file changed, 9 insertions(+), 2 deletions(-)
diff --git a/gotui.c b/gotui.c @@ -43,9 +43,10 @@ void display(struct stone* stone_list, int count, int color) { for(int i=0;i<count;i++) { if(stone_list[i].color==BLACK) tb_printf(stone_list[i].x,stone_list[i].y,0,0,"○"); else tb_printf(stone_list[i].x,stone_list[i].y,0,0,"●"); - tb_printf(15,15,0,0,"%d",stone_list[i].x); - tb_printf(0,0,0,0,"machin : %d",color); } + /*char *color_to_display="white"; + if(color) { color_to_display="white"; } else { color_to_display="black"; } + tb_printf(0,9,0,0,"%s to play\n",color_to_display);*/ } int main(int argc, char **argv) { @@ -76,6 +77,12 @@ int main(int argc, char **argv) { stone_count++; break; case 65511: /*MouseRight*/ + for (int i=0;i<stone_count;i++) { + if (ev.x==stone_list[i].x && ev.y==stone_list[i].y) { + for (int j=i;j<stone_count;j++) stone_list[j]=stone_list[j+1]; + break; + } + } break; case 113: tb_shutdown();