\ VP-scorestrings
\
\ $Id: VP-scorestrings.txt,v 1.1 2000/10/25 00:17:43 kris_johnson Exp $

\ Copyright 2000
\ Kristopher D. Johnson
\ 
\ See LICENSE-JacksOrBetter for the
\ conditions under which you may
\ use, redistribute, or modify this 
\ code, or create derived works.

docneeds VP-lib
docneeds VP-zstrings
docneeds VP-score

.( VP-scorestrings... )

\ Array of (zadr, u) pairs
create ScoreTable
  #Score 2* cells allot

\ Set contents of adr and adr+1
\ to x1 and x2, and return
\ adr+2
: set-next-2 ( x2 x1 adr -- adr )
  !-leave-addr cell+
  !-leave-addr cell+
;

\ Copy string to dictionary as
\ zero-terminated string, and
\ set next two entries of 
\ ScoreTable to its address
\ and size
: Score" ( adr <ccc>" -- adr2 )
  >r align here >r ( R: adr here )
  [char] " parse ( cadr u )
  dup >r ( R: adr here u )
  zplace,
  r> r> r> set-next-2 ( adr )
;

ScoreTable
Score" Loss"
Score" One Pair"
Score" Two Pair"
Score" Three of a Kind"
Score" Straight"
Score" Flush"
Score" Full House"
Score" Four of a Kind"
Score" Straight Flush"
Score" Royal Flush"
drop

: score>zstring ( score -- zadr u )
  2* cells ScoreTable +
  dup @ swap cell+ @
;

