proc kartenWert {karte} {
  switch [string index $karte 0] {
    a {return 1}
    2 {return 2}
    3 {return 3}
    4 {return 4}
    5 {return 5}
    6 {return 6}
    7 {return 7}
    8 {return 8}
    9 {return 9}
    0 {return 10}
    b {return 11}
    d {return 12}
    k {return 13}
  }
}
proc aufsteigend {unten oben zyklisch} {
  global aktuellErste

  set wertO [kartenWert $oben]
  set wertU [kartenWert $unten]

  if {!$zyklisch && [kartenWert $aktuellErste] == $wertO} {return 0}

  return [expr {($wertU + 1 - $wertO) % 13 == 0}]
}
proc unecht {a b} {
  set farbeA  [string index $a 1]
  set farbeB  [string index $b 1]
  set aIstRot [expr {($farbeA == "c") || ($farbeA == "h")}]
  set bIstRot [expr {($farbeB == "c") || ($farbeB == "h")}]
  return [expr $aIstRot!=$bIstRot]
}
proc echt {a b} {
  return [expr {[string index $a 1] == [string index $b 1]}]
}
  proc unifRand {x} {
    global jRandom randoms

    if {$jRandom == 0} {newRandoms} else {incr jRandom -1}
    set y [expr $x*$randoms($jRandom)]
    scan $y "%d" y
    return [expr $y==$x?0:$y]
  }
  proc initr {seed} {
    global randoms

    set j [expr $seed/2*2+1]

    while {$j > 1} {set j [expr $j/2.0]}
    set k 1
    for {set i 0} {$i < 55} {incr i} {
      set jj $k
      set k [expr $j-$k]
      set j $jj
      if {$k < 0} {set k [expr $k+1.0]}
      set randoms([expr ($i*21)%55]) $j
    }
    newRandoms
    newRandoms
    newRandoms
  }
  set jRandom 0
  proc newRandoms {} {
    global jRandom randoms

    for {set k 0} {$k < 24} {incr k} {
      set x [expr $randoms($k)-$randoms([expr $k+31])]
      if {$x < 0} {set x [expr $x+1.0]}
      set randoms($k) $x
    }
    for {set k 24} {$k < 55} {incr k} {
      set x [expr $randoms($k)-$randoms([expr $k-24])]
      if {$x < 0} {set x [expr $x+1.0]}
      set randoms($k) $x
    }
    set jRandom 54
  }
