Track and which letters are not used in the word
This commit is contained in:
parent
47efb1dbb2
commit
c538bd04f7
5
Makefile
5
Makefile
|
@ -21,4 +21,7 @@ clean:
|
|||
|
||||
distclean: clean
|
||||
|
||||
.PHONY: all clean distclean
|
||||
run: dosdl.com
|
||||
dosbox dosdl.com
|
||||
|
||||
.PHONY: all clean distclean run
|
||||
|
|
|
@ -19,7 +19,6 @@ Missing features
|
|||
- Ability to set the seed manually
|
||||
- Hard and extra hard modes
|
||||
- In-program help
|
||||
- Display of letters that have not been ruled out
|
||||
|
||||
Word lists
|
||||
----------
|
||||
|
|
30
dosdl.asm
30
dosdl.asm
|
@ -221,6 +221,8 @@ check_targets:
|
|||
|
||||
word_not_found:
|
||||
mov ah, 9
|
||||
mov dx, space_dash_space_str
|
||||
int 0x21
|
||||
mov dx, not_found_str
|
||||
int 0x21
|
||||
|
||||
|
@ -277,7 +279,6 @@ find_exact_hits:
|
|||
|
||||
find_wrong_places:
|
||||
; Zero out first
|
||||
mov di, wrong_places
|
||||
mov cx, 5
|
||||
xor al, al
|
||||
rep stosb
|
||||
|
@ -334,6 +335,15 @@ find_wrong_places:
|
|||
.not_found_in_wrong_places:
|
||||
loop .count_wrong_places
|
||||
|
||||
; If not used in target at all, remove from list of possible letters
|
||||
test bh, bh
|
||||
jnz .used_in_target
|
||||
|
||||
xor dh, dh
|
||||
mov di, dx
|
||||
mov byte [alphabet + di - 'a'], ' '
|
||||
|
||||
.used_in_target:
|
||||
; If in target more than in feedback → wrong place
|
||||
cmp bh, bl ; target <= feedback
|
||||
jbe .loop
|
||||
|
@ -374,6 +384,20 @@ print_feedback:
|
|||
|
||||
inc bp
|
||||
loop .loop
|
||||
|
||||
mov ah, 9
|
||||
mov dx, space_dash_space_str
|
||||
int 0x21
|
||||
|
||||
mov cx, 26
|
||||
mov si, alphabet
|
||||
.alphabet_loop:
|
||||
lodsb
|
||||
mov dl, al
|
||||
mov ah, 2
|
||||
int 0x21
|
||||
loop .alphabet_loop
|
||||
|
||||
call newline
|
||||
|
||||
is_finished:
|
||||
|
@ -722,6 +746,7 @@ add32:
|
|||
%endif
|
||||
|
||||
section .data
|
||||
alphabet db 'abcdefghijklmnopqrstuvwxyz'
|
||||
target times 5 db 0
|
||||
guess times 5 db 0
|
||||
|
||||
|
@ -750,7 +775,8 @@ day db 0
|
|||
|
||||
section .rodata
|
||||
|
||||
not_found_str db ' - word not found$'
|
||||
space_dash_space_str db ' - $'
|
||||
not_found_str db 'word not found$'
|
||||
erase_word_str db ' $'
|
||||
word_was_str db 'The word was: $'
|
||||
correct_in_str db 'Correct in $'
|
||||
|
|
Loading…
Reference in New Issue