package util; use Storable (); use Scalar::Util (); my $staterc = "$ENV{HOME}/.kgsueme"; $stateversion = 1; our $state = -r $staterc ? Storable::retrieve($staterc) : {}; if ($state->{version} != $stateversion) { warn "$staterc has wrong version - ignoring it.\n"; $state = {}; } $state->{version} = $stateversion; $::config = $state->{config} ||= {}; $::config->{speed} = 0;#d# optimize for speed or memory? $::config->{conserve_memory} = 0; # try to conserve memory at the expense of speed $::config->{randomize} = 0; # randomize placement of stones sub save_config { >k::save_state; Storable::nstore($state, $staterc); appwin::status("save_state", "layout saved"); } 1;