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
|
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
|
- Ability to set the seed manually
|
||||||
- Hard and extra hard modes
|
- Hard and extra hard modes
|
||||||
- In-program help
|
- In-program help
|
||||||
- Display of letters that have not been ruled out
|
|
||||||
|
|
||||||
Word lists
|
Word lists
|
||||||
----------
|
----------
|
||||||
|
|
30
dosdl.asm
30
dosdl.asm
|
@ -221,6 +221,8 @@ check_targets:
|
||||||
|
|
||||||
word_not_found:
|
word_not_found:
|
||||||
mov ah, 9
|
mov ah, 9
|
||||||
|
mov dx, space_dash_space_str
|
||||||
|
int 0x21
|
||||||
mov dx, not_found_str
|
mov dx, not_found_str
|
||||||
int 0x21
|
int 0x21
|
||||||
|
|
||||||
|
@ -277,7 +279,6 @@ find_exact_hits:
|
||||||
|
|
||||||
find_wrong_places:
|
find_wrong_places:
|
||||||
; Zero out first
|
; Zero out first
|
||||||
mov di, wrong_places
|
|
||||||
mov cx, 5
|
mov cx, 5
|
||||||
xor al, al
|
xor al, al
|
||||||
rep stosb
|
rep stosb
|
||||||
|
@ -334,6 +335,15 @@ find_wrong_places:
|
||||||
.not_found_in_wrong_places:
|
.not_found_in_wrong_places:
|
||||||
loop .count_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
|
; If in target more than in feedback → wrong place
|
||||||
cmp bh, bl ; target <= feedback
|
cmp bh, bl ; target <= feedback
|
||||||
jbe .loop
|
jbe .loop
|
||||||
|
@ -374,6 +384,20 @@ print_feedback:
|
||||||
|
|
||||||
inc bp
|
inc bp
|
||||||
loop .loop
|
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
|
call newline
|
||||||
|
|
||||||
is_finished:
|
is_finished:
|
||||||
|
@ -722,6 +746,7 @@ add32:
|
||||||
%endif
|
%endif
|
||||||
|
|
||||||
section .data
|
section .data
|
||||||
|
alphabet db 'abcdefghijklmnopqrstuvwxyz'
|
||||||
target times 5 db 0
|
target times 5 db 0
|
||||||
guess times 5 db 0
|
guess times 5 db 0
|
||||||
|
|
||||||
|
@ -750,7 +775,8 @@ day db 0
|
||||||
|
|
||||||
section .rodata
|
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 ' $'
|
erase_word_str db ' $'
|
||||||
word_was_str db 'The word was: $'
|
word_was_str db 'The word was: $'
|
||||||
correct_in_str db 'Correct in $'
|
correct_in_str db 'Correct in $'
|
||||||
|
|
Loading…
Reference in New Issue