ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/kgsueme/kgsueme/util.pl
Revision: 1.4
Committed: Sat May 31 16:08:48 2003 UTC (21 years ago) by pcg
Content type: text/plain
Branch: MAIN
Changes since 1.3: +9 -0 lines
Log Message:
*** empty log message ***

File Contents

# User Rev Content
1 pcg 1.1 package util;
2    
3     use Storable ();
4     use Scalar::Util ();
5    
6     my $staterc = "$ENV{HOME}/.kgsueme";
7    
8 pcg 1.4 $stateversion = 1;
9    
10 pcg 1.3 our $state = -r $staterc ? Storable::retrieve($staterc) : {};
11 pcg 1.4
12     if ($state->{version} != $stateversion) {
13     warn "$staterc has wrong version - ignoring it.\n";
14     $state = {};
15     }
16    
17     $state->{version} = $stateversion;
18 pcg 1.1
19     $::config = $state->{config} ||= {};
20    
21 pcg 1.2 $::config->{speed} = 0;#d# optimize for speed or memory?
22 pcg 1.1 $::config->{conserve_memory} = 0; # try to conserve memory at the expense of speed
23     $::config->{randomize} = 0; # randomize placement of stones
24    
25     sub save_config {
26 pcg 1.3 &gtk::save_state;
27 pcg 1.1 Storable::nstore($state, $staterc);
28 pcg 1.3 appwin::status("save_state", "layout saved");
29 pcg 1.1 }
30    
31     1;
32