HI-LO Number Challenge
Moderator: Moderators
HI-LO Number Challenge
Exercise your brain with this number challenge game.
Requires 8k+
Complete the grid by entering numbers in the correct position according to the arrows. Info provided on the disk. Much faster version. With added joystick control.
Requires 8k+
Complete the grid by entering numbers in the correct position according to the arrows. Info provided on the disk. Much faster version. With added joystick control.
Last edited by vicist on Tue Dec 24, 2019 5:54 pm, edited 6 times in total.
Re: HI-LO Number Challenge
Doh.
Nothing major but forgot to link to the farewell screen if you complete the puzzle and choose not to play again.
All download files updated.
Apologies - 'I am a forgetful old Hector' (anyone remember that one?)
Nothing major but forgot to link to the farewell screen if you complete the puzzle and choose not to play again.
All download files updated.
Apologies - 'I am a forgetful old Hector' (anyone remember that one?)
- Junkman
- Vic 20 Newbie
- Posts: 6
- Joined: Sun Jan 13, 2019 7:38 pm
- Website: http://sl0w.org/
- Location: ct,usa
Re: HI-LO Number Challenge
Managed to get Star Commander working today and copied this to a floppy. Didn't load on the stock vic but with 8k it works fine.
I think i need to go back to Kindergarten because even on that mode this is challenging
I think i need to go back to Kindergarten because even on that mode this is challenging
Re: HI-LO Number Challenge
Sorry about not mentioning 8k is required to run the game. It is mentioned on the announcement page however.
I will edit the original post.
The levels of difficulty are just my attempt at a little humour.
The puzzle is quite hard on any level. The amount of given cells at the start (these are placed randomly, not strategically) should reduce the amount of brain strain to get going.
Hope you enjoy playing it nonetheless.
I will edit the original post.
The levels of difficulty are just my attempt at a little humour.
The puzzle is quite hard on any level. The amount of given cells at the start (these are placed randomly, not strategically) should reduce the amount of brain strain to get going.
Hope you enjoy playing it nonetheless.
Re: HI-LO Number Challenge
Another gremlin!!
This one stopped it skipping over the random grid placement when loading, resulting in an extra cell being filled in.
Had that check in place before. Just seemed to have disappeared somehow.
As before, all files amended.
This one stopped it skipping over the random grid placement when loading, resulting in an extra cell being filled in.
Had that check in place before. Just seemed to have disappeared somehow.
As before, all files amended.
Re: HI-LO Number Challenge
Sloppy use of zero page address caused a screen layout glitch if loading 'HI-LO' from the 'INFO' program (with 8k) and then loading a saved game.
Higher ram configurations were not affected.
Once again, my apologies. Files amended.
Higher ram configurations were not affected.
Once again, my apologies. Files amended.
Re: HI-LO Number Challenge
After following Mike's excellent article A sample programming session in VICMON I decided to try my hand at turning the more difficult (and slow) mathematical basic equations into machine code.
My first attempt at this game was all in basic and the grid took up to 50 seconds to generate!
I managed to code the display of the grid and calculate the direction of the arrows in m/c but the random numbers were still being done by basic. This brought the time taken to generate down to 3-10 seconds. A vast improvement and version 1 was posted.
Not quite satisfied with this, I studied this article - Making a random number in Assembly. Now that the numbers are generated in m/c, the grid appears instantly.
I've given the cursor wrap-around movement and increased the number of starting cells per difficulty setting to 15, 10 and 6 respectively. The random nature of the grid can make even the easy setting very challenging. Changed the spelling of the easy setting from 'kindergarden' (anglo) to 'kindergarten' and updated the 'info' prg.
Version 1.1 is available from the first post.
My first attempt at this game was all in basic and the grid took up to 50 seconds to generate!
I managed to code the display of the grid and calculate the direction of the arrows in m/c but the random numbers were still being done by basic. This brought the time taken to generate down to 3-10 seconds. A vast improvement and version 1 was posted.
Not quite satisfied with this, I studied this article - Making a random number in Assembly. Now that the numbers are generated in m/c, the grid appears instantly.
I've given the cursor wrap-around movement and increased the number of starting cells per difficulty setting to 15, 10 and 6 respectively. The random nature of the grid can make even the easy setting very challenging. Changed the spelling of the easy setting from 'kindergarden' (anglo) to 'kindergarten' and updated the 'info' prg.
Version 1.1 is available from the first post.
- highinfidelity
- Vic 20 Nerd
- Posts: 644
- Joined: Thu Jul 28, 2011 2:34 am
- Website: http://www.hirtel.it
- Location: Torino, Italy.
Re: HI-LO Number Challenge
That's interesting. What an amazing difference of time!
GOD is REAL. Unless declared DOUBLE PRECISION.
Re: HI-LO Number Challenge
v1.2
Added joystick control and fixed a minor bug.
You now have to clear the cell to make a change. This prevents overwriting the cell accidentally.
Download from first post.
Added joystick control and fixed a minor bug.
You now have to clear the cell to make a change. This prevents overwriting the cell accidentally.
Download from first post.
Re: HI-LO Number Challenge
hello, can ju pleys in sourcecode?
thanks
greeting.
thanks
greeting.
Re: HI-LO Number Challenge
The program consists of a BASIC stub, machine code routines, some custom characters and the main BASIC program that starts at $2000 (8192).
You can see the m/c in the code window below (please don't laugh). The BASIC parts of the program are 'TOP SECRET'.
You can see the m/c in the code window below (please don't laugh). The BASIC parts of the program are 'TOP SECRET'.
Code: Select all
* = $188a
playerlo = 1
playerhi = 2
check = 3
offset = 4
factor1 = 5
factor2 = 6
safe = 247
rloop = 248
cmemlo = 249
cmemhi = 250
pos = 251
gridlo = 253
gridhi = 254
rnd = 673
shuffle = 681
spare = 689
grid = 828
player = 892
colourmem = 956
ds = 4187
cs = 37979
;--------------------------
;- initialise player, colourmem,
;- grid, playerlo and counters
;--------------------------
lda #8
sta rloop
lda #0
sta playerhi
sta safe
ldx #64
soul dex
sta player,x
sta colourmem,x
sta grid,x
bne soul
rts
;-------------------------
;- initialize shuffle & check -
;-------------------------
produce ldx #8
down txa
clc
sta shuffle-1,x ; place 1-8 in shuffle
dex
bne down
lda #7 ; loop counter
sta pos
;-------------------------
xxx lda pos
cmp #0 ; is pos 0?
beq ggg ; yes - skip random routine
ttt jsr rdom ; no - get random number
clc
cmp pos ; same as pos?
beq ggg ; yes - continue
bpl ttt ; too high - try again
ggg ldy pos
tax
lda shuffle,x
sta rnd,y
txa
tay
ppp lda pos ; if check=0 then end
beq hhh
iny
lda shuffle,y ; jog numbers left
sta shuffle,x
inx
cpy pos
bmi ppp ; keep jogging
dec pos
bpl xxx ; check >0 - go again
hhh jsr gridit ; place in grid
lda gridlo ; any spares?
bne produce ; yes - try again
dec rloop ; have we looped 8 times?
bne produce ; no
rts ; yes - back to basic
;--------------------------
;- calculate grid position
;--------------------------
gridit lda #0
sta playerlo
sta check
sta gridlo
lda #8
sta gridhi
comp lda playerlo
asl
asl
asl
tax
adc playerhi
sta pos
tay
pha
lda playerhi
beq ccc
pla
sec
sbc #1
jmp wall
ccc pla
wall sta safe
;--------------------------
;- compare rnd with grid position
;--------------------------
step lda rnd
hop cmp grid,x
bne ok
jmp bad
ok cpx safe
beq good
inx
jmp hop
;--------------------------
;- put in spare
;--------------------------
bad ldx gridlo
sta spare,x
inc gridlo
jmp salt
;--------------------------
;- put in grid
;--------------------------
good sta grid,y
inc playerlo
;--------------------------
;- shift rnd left
;--------------------------
salt ldx #0
ldy #1
fish cpy gridhi
beq chip
lda rnd,y
sta rnd,x
inx
iny
jmp fish
chip dec gridhi
bne comp
;--------------------------
;- any spare?
;--------------------------
lda gridlo
beq done
cmp check
beq tryx
;--------------------------
;- transfer spare to rnd
;--------------------------
more ldx #0
goat lda spare,x
sta rnd,x
inx
cpx gridlo
bne goat
stx gridhi
stx check
lda #0
sta gridlo
jmp comp
lda rloop
cmp #8
beq tryx
done inc playerhi
tryx rts
;--------------------
;- push screen right -
;--------------------
clc
lda 36864
adc #1
sta 36864
;--------------------
;- cyan right playerhi -
;--------------------
lda #<4117
sta 1
lda #>4117
sta 2
lda #<37909
sta 253
lda #>37909
sta 254
ldy #0
loop1 lda #62
sta (1),y
lda #3
sta (253),y
iny
cpy #23
beq bum
lda 1
adc #21
sta 1
bcc arm
inc 2
arm clc
lda 253
adc #21
sta 253
bcc leg
inc 254
leg clc
jmp loop1
;-------------------
;- save/quit display -
;-------------------
bum ldy #0
ldx #0
lda 251
cmp #64
trip bne loop3
lda erase,x
jmp pass1
loop3 lda display,x
pass1 cmp #0
beq out
sta 4162,y
lda #0
sta 37954,y
tya
clc
adc #20
tay
inx
lda 251
cmp #64
bne loop4
lda erase,x
jmp pass2
loop4 lda display,x
pass2 sta 4162,y
lda #0
sta 37954,y
tya
clc
adc #2
tay
inx
lda 251
cmp #64
bne hip
jmp trip
hip jmp loop3
out rts
display text'sqauviet'
byte 0
erase text' '
byte 0
;-------------------
;- grid data display -
;-------------------
clc
lda #<ds
sta 1
lda #>ds
sta 2
lda #<cs
sta 253
lda #>cs
sta 254
ldy #0
ldx #0
gold lda player,x
adc #48
sta (1),y
lda colourmem,x
sta (253),y
iny
iny
inx
cpy #16
bne gold
cpx #64
beq nobby
lda 1
adc #44
sta 1
bcc again
inc 2
again clc
lda 253
adc #44
sta 253
bcc again2
inc 254
again2 clc
ldy #0
jmp gold
;--------------------
;- higher/lower routine -
;--------------------
;- playerlos -
;--------------------
nobby clc
lda #<ds+1
sta 1
lda #>ds
sta 2
lda #<cs+1
sta 253
lda #>cs
sta 254
ldy #0
ldx #0
head LDA grid,x
CMP grid+1,x
BCS higher
lda #30
jmp lower
higher lda #29
lower sta (1),y
lda #2
sta (253),y
iny
iny
inx
cpy #14
bne head
cpx #63
beq playerhis
lda 1
adc #44
sta 1
bcc tooth
inc 2
tooth clc
lda 253
adc #44
sta 253
bcc tooth2
inc 254
tooth2 clc
ldy #0
inx
jmp head
;--------------------
;- playerhis -
;--------------------
playerhis clc
lda #<ds+22
sta 1
lda #>ds
sta 2
lda #<cs+22
sta 253
lda #>cs
sta 254
ldy #0
ldx #0
back LDA grid,x
CMP grid+8,x
BCS hi
lda #27
jmp lo
hi lda #28
lo sta (1),y
lda #2
sta (253),y
iny
iny
inx
cpy #16
bne back
cpx #56
beq gone
lda 1
adc #44
sta 1
bcc front
inc 2
front clc
lda 253
adc #44
sta 253
bcc front2
inc 254
front2 clc
ldy #0
jmp back
gone rts
;--------------------
;- check for win -
;--------------------
ldx #0
tail lda grid,x
cmp player,x
bne elbow
inx
cpx #64
bne tail
elbow stx 251
rts
;--------------------
;- help -
;--------------------
clc
lda #<cs
sta 253
lda #>cs
sta 254
ldy #0
ldx #0
look lda player,x
beq next1
cmp grid,x
beq next1
lda #2
sta (253),y
next1 iny
iny
inx
cpy #16
bne look
cpx #64
beq twist
clc
lda 253
adc #44
sta 253
bcc tip
inc 254
tip clc
ldy #0
jmp look
twist rts
;----------------------
;- difficulty settings -
;----------------------
lda 252
cmp #1
beq qqqq
lda #0
sta check
start lda 252
cmp check
bne wwww
qqqq rts
wwww lda #<grid
sta gridlo
lda #<player
sta playerlo
lda #<colourmem
sta cmemlo
lda #3
sta gridhi
sta playerhi
sta cmemhi
jsr rdom
sta offset
jsr rdom
sta factor2
ldy offset
asl
asl
asl
clc
adc gridlo
sta gridlo
adc #64
sta playerlo
adc #64
sta cmemlo
lda (playerlo),y
beq zzzz
jmp wwww
zzzz lda (gridlo),y
sta (playerlo),y
lda #6
sta (cmemlo),y
;-------------------------
;- multiply Y by 44 -
;-------------------------
lda #44
sta factor1
lda factor2
LDA #0
LDX #$8
LSR factor1
loop BCC no_add
CLC
ADC factor2
no_add ROR
ROR factor1
DEX
BNE loop
STA factor2
;-------------------------
;- put player data to screen -
;-------------------------
lda #<ds
sta cmemlo
clc
adc factor1
sta cmemlo
lda #>ds
sta cmemhi
adc factor2
sta cmemhi
ldy offset
lda (playerlo),y
clc
adc #48
pha
tya
asl
tay
pla
sta (cmemlo),y
;-------------------------
;- colour position blue -
;-------------------------
lda #<cs
sta cmemlo
clc
adc factor1
sta cmemlo
lda #>cs
sta cmemhi
adc factor2
sta cmemhi
lda offset
asl
tay
lda #6
sta (cmemlo),y
inc check
jmp start
;----------------------------
rdom lda #$01
asl
bcc rrrr
eor #$4d
rrrr sta rdom+1
eor $9124
clc
and #7
rts
incbin "hl2.cst",0,63
Re: HI-LO Number Challenge
DOH!! Had the drive hard-coded to 8 (old habits) for loading and saving.
Changed it to last drive # used.
Changed it to last drive # used.