aboutsummaryrefslogtreecommitdiff
path: root/games/scrabbleai
diff options
context:
space:
mode:
authorB. Watson <urchlay@slackware.uk>2023-03-24 07:54:40 +0000
committerWilly Sudiarto Raharjo <willysr@slackbuilds.org>2023-03-25 10:01:53 +0700
commita3b5d52c1cad8103fa134aa5059cac2e7a9e5ff4 (patch)
treeeb6eefb6a4ff7a3c8e1470723583f28f019ea5ca /games/scrabbleai
parent60526b17c8fec5d548765174365f059d7d4ab921 (diff)
games/scrabbleai: Added (Scrabble[TM] game for Linux)
Signed-off-by: bedlam <dave@slackbuilds.org> Signed-off-by: Willy Sudiarto Raharjo <willysr@slackbuilds.org>
Diffstat (limited to 'games/scrabbleai')
-rw-r--r--games/scrabbleai/README4
-rw-r--r--games/scrabbleai/doinst.sh9
-rw-r--r--games/scrabbleai/git2tarxz.sh42
-rw-r--r--games/scrabbleai/scrabbleai.6154
-rw-r--r--games/scrabbleai/scrabbleai.SlackBuild104
-rw-r--r--games/scrabbleai/scrabbleai.desktop9
-rw-r--r--games/scrabbleai/scrabbleai.info10
-rw-r--r--games/scrabbleai/scrabbleai.rst154
-rw-r--r--games/scrabbleai/slack-desc19
-rw-r--r--games/scrabbleai/unix.diff97
10 files changed, 602 insertions, 0 deletions
diff --git a/games/scrabbleai/README b/games/scrabbleai/README
new file mode 100644
index 0000000000000..94c7a48ae0015
--- /dev/null
+++ b/games/scrabbleai/README
@@ -0,0 +1,4 @@
+scrabbleai (Scrabble[TM] game for Linux)
+
+scrabbleai is an application for Linux that lets you play the popular
+word game against a computer opponent at varying difficulties.
diff --git a/games/scrabbleai/doinst.sh b/games/scrabbleai/doinst.sh
new file mode 100644
index 0000000000000..3e5691a052b5b
--- /dev/null
+++ b/games/scrabbleai/doinst.sh
@@ -0,0 +1,9 @@
+if [ -x /usr/bin/update-desktop-database ]; then
+ /usr/bin/update-desktop-database -q usr/share/applications >/dev/null 2>&1
+fi
+
+if [ -e usr/share/icons/hicolor/icon-theme.cache ]; then
+ if [ -x /usr/bin/gtk-update-icon-cache ]; then
+ /usr/bin/gtk-update-icon-cache usr/share/icons/hicolor >/dev/null 2>&1
+ fi
+fi
diff --git a/games/scrabbleai/git2tarxz.sh b/games/scrabbleai/git2tarxz.sh
new file mode 100644
index 0000000000000..03ef01a0ac371
--- /dev/null
+++ b/games/scrabbleai/git2tarxz.sh
@@ -0,0 +1,42 @@
+#!/bin/sh
+
+# Create source tarball from git repo
+
+# Note that this script doesn't need to be run as root. It does need to
+# be able to write to the current directory it's run from.
+
+# Takes one optional argument, which is the commit or tag to create a
+# tarball of. With no arg, HEAD is used.
+
+PRGNAM=scrabbleai
+CLONE_URL=https://github.com/apikler/ScrabbleAI
+
+set -e
+
+GITDIR=$( mktemp -dt $PRGNAM.git.XXXXXX )
+rm -rf $GITDIR
+git clone $CLONE_URL $GITDIR
+
+CWD="$( pwd )"
+cd $GITDIR
+
+if [ "$1" != "" ]; then
+ git reset --hard "$1" || exit 1
+fi
+
+GIT_SHA=$( git rev-parse --short HEAD )
+
+DATE=$( git log --date=format:%Y%m%d --format=%cd | head -1 )
+
+VERSION=${DATE}_${GIT_SHA}
+
+find . -name .git\* -print0 | xargs -0 rm -rf
+
+cd "$CWD"
+rm -rf $PRGNAM-$VERSION $PRGNAM-$VERSION.tar.xz
+mv $GITDIR $PRGNAM-$VERSION
+tar cvfJ $PRGNAM-$VERSION.tar.xz $PRGNAM-$VERSION
+
+echo
+echo "Created tarball: $PRGNAM-$VERSION.tar.xz"
+echo "VERSION=$VERSION"
diff --git a/games/scrabbleai/scrabbleai.6 b/games/scrabbleai/scrabbleai.6
new file mode 100644
index 0000000000000..f420645e94ddc
--- /dev/null
+++ b/games/scrabbleai/scrabbleai.6
@@ -0,0 +1,154 @@
+.\" Man page generated from reStructuredText.
+.
+.
+.nr rst2man-indent-level 0
+.
+.de1 rstReportMargin
+\\$1 \\n[an-margin]
+level \\n[rst2man-indent-level]
+level margin: \\n[rst2man-indent\\n[rst2man-indent-level]]
+-
+\\n[rst2man-indent0]
+\\n[rst2man-indent1]
+\\n[rst2man-indent2]
+..
+.de1 INDENT
+.\" .rstReportMargin pre:
+. RS \\$1
+. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin]
+. nr rst2man-indent-level +1
+.\" .rstReportMargin post:
+..
+.de UNINDENT
+. RE
+.\" indent \\n[an-margin]
+.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]]
+.nr rst2man-indent-level -1
+.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]]
+.in \\n[rst2man-indent\\n[rst2man-indent-level]]u
+..
+.TH "SCRABBLEAI" 6 "2023-03-24" "20150324_6f8db6b" "SlackBuilds.org"
+.SH NAME
+scrabbleai \- Scrabble[TM] game
+.\" RST source for scrabbleai(6) man page. Convert with:
+.
+.\" rst2man.py scrabbleai.rst > scrabbleai.6
+.
+.SH SYNOPSIS
+.sp
+\fBscrabbleai\fP
+.SH DESCRIPTION
+.sp
+\fBscrabbleai\fP is an application for Linux that lets you play
+the popular word game against a computer opponent at varying
+difficulties. It has a graphical user interface, and is played with
+the mouse and keyboard.
+.sp
+There is no way to play against another human, either locally or
+via the network. This is strictly a single\-player game.
+.sp
+There are no command\-line options.
+.SH GAMEPLAY
+.sp
+At startup, or after choosing \fBNew Game\fP from the \fBFile\fP menu, choose
+a difficulty level (1 to 10; default is 5), then click \fBStart Game\fP\&.
+.sp
+You (the human) always go first. If you don\(aqt like this, you can click
+\fBPass Turn\fP to make the AI play first. Remember that on the first
+turn, you have to place one of your tiles on the center square of the
+board.
+.sp
+On your turn, use the mouse to drag letter tiles onto the board
+to spell out a word in the usual Scrabble fashion. Your move isn\(aqt
+finalized until you click \fBMake Move\fP and the game decides your word
+is valid. Until then, you can move your tiles around as desired, or
+click \fBReturn Tiles to Rack\fP to start over.
+.sp
+When placing a blank tile, you\(aqll be prompted to right\-click on it and
+set the letter it represents. If you return the blank tile to the rack
+after doing this, don\(aqt forget to right\-click on it and press Space,
+to make it appear blank again. If you forget which tile was the blank
+one, it\(aqs the one with no score number in the lower\-right corner.
+.sp
+If your rack is empty at the end of the game, you still get a turn;
+you must click \fBPass Turn\fP to end the game. When the game is over,
+click \fBFile\fP => \fBNew Game\fP to start a new one.
+.SH NOTES
+.sp
+Note that the first time you start a new game, it will take
+longer than usual to launch as the dictionary is cached for future
+use. Subsequent games (even after relaunching the program) will be
+able to skip this step and start up faster.
+.sp
+The AI is based on an algorithm from a paper written by Andrew
+W. Appel and Guy J. Jacobson, which you can find here::
+\fI\%http://www.cs.cmu.edu/afs/cs/academic/class/15451\-s06/www/lectures/scrabble.pdf\fP
+.sp
+The AI is \fIreally\fP good. However many words you know, it knows
+more. On level 5, the AI beats the author of this man page about 50%
+of the time, with final scores averaging above 250. The original
+Scrabble rules say that a good player should be able to score 300, so
+your mileage may vary.
+.sp
+If you want to peek at the dictionary, there are two of them located
+in /usr/doc/scrabbleai\-20150324_6f8db6b/. \fBenable.txt\fP is used to validate
+your words, and a smaller \fBospd.txt\fP is used for the computer\(aqs
+words.
+.sp
+The game board is the standard 15x15 version, with the bonus squares
+in the regular locations. There\(aqs no way to customize the board or the
+tile distribution.
+.SH SCREENSHOTS
+.sp
+The intro screen: \fI\%https://apikler.github.io/ScrabbleAI/intro_screen.png\fP
+.sp
+The main game screen: \fI\%https://apikler.github.io/ScrabbleAI/game_screen.png\fP
+.sp
+A completed game: \fI\%https://apikler.github.io/ScrabbleAI/finished_game.png\fP
+.sp
+The help dialog: \fI\%https://apikler.github.io/ScrabbleAI/help_dialog.png\fP
+.SH VIDEOS
+.sp
+The AI makes a move: \fI\%https://apikler.github.io/ScrabbleAI/ai_move.html\fP
+.sp
+Resizing the window: \fI\%http://apikler.github.io/ScrabbleAI/resize.html\fP
+.SH FILES
+.sp
+The directory \fB~/.config/ScrabbleAI/\fP contains the settings and
+cached dictionary, as \fBperl\fP(1) \fBStorable\fP(3) files, which
+means they\(aqre not human\-reable or \-editable. If the directory or its
+contents do not exist at startup, \fBscrabbleai\fP will create them.
+.INDENT 0.0
+.TP
+.B \fBsettings\fP
+Application settings: default difficulty, window size and position.
+.TP
+.B \fBlibrary\fP
+Cached dictionary, used to speed program startup.
+.UNINDENT
+.SH COPYRIGHT
+.sp
+See the file /usr/doc/scrabbleai\-20150324_6f8db6b/LICENSE for license information.
+.SH AUTHORS
+.sp
+scrabbleai was written by apikler (GitHub username).
+.sp
+This man page written for the SlackBuilds.org project
+by B. Watson, and is licensed under the WTFPL.
+.SH DISCLAIMER
+.sp
+This program is free, not for profit, and for educational purposes
+only. Any usage of elements from the Scrabble board game is provided
+only to illustrate the functioning of the AI. Scrabble is a registered
+trademark belonging to Hasbro Inc in the US, and to J.W. Spear &
+Sons Ltd., a subsidiary of Mattel Inc., throughout the rest of the
+world. Neither the author nor this program are affiliated with the
+Scrabble Crossword Game, Hasbro, Spear & Sons, or Mattel in any
+fashion.
+.SH SEE ALSO
+.sp
+The scrabbleai homepage: \fI\%https://github.com/apikler/ScrabbleAI\fP
+.sp
+The Wikipedia entry on Scrabble: \fI\%https://en.wikipedia.org/wiki/Scrabble\fP
+.\" Generated by docutils manpage writer.
+.
diff --git a/games/scrabbleai/scrabbleai.SlackBuild b/games/scrabbleai/scrabbleai.SlackBuild
new file mode 100644
index 0000000000000..a756f03ef3b3f
--- /dev/null
+++ b/games/scrabbleai/scrabbleai.SlackBuild
@@ -0,0 +1,104 @@
+#!/bin/bash
+
+# Slackware build script for scrabbleai
+
+# Written by B. Watson (urchlay@slackware.uk)
+
+# Licensed under the WTFPL. See http://www.wtfpl.net/txt/copying/ for details.
+
+# This hasn't had any activity upstream since 2015, but it does work
+# fine and play a good game of Scrabble. Before you complain about old
+# code, remember that Scrabble itself was invented in 1938, and it's
+# still a fun game (if you don't agree, why are you building this?)
+
+cd $(dirname $0) ; CWD=$(pwd)
+
+PRGNAM=scrabbleai
+VERSION=${VERSION:-20150324_6f8db6b}
+BUILD=${BUILD:-1}
+TAG=${TAG:-_SBo}
+PKGTYPE=${PKGTYPE:-tgz}
+ARCH=noarch
+
+if [ ! -z "${PRINT_PACKAGE_NAME}" ]; then
+ echo "$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.$PKGTYPE"
+ exit 0
+fi
+
+TMP=${TMP:-/tmp/SBo}
+PKG=$TMP/package-$PRGNAM
+OUTPUT=${OUTPUT:-/tmp}
+
+set -e
+
+rm -rf $PKG
+mkdir -p $TMP $PKG $OUTPUT
+cd $TMP
+rm -rf $PRGNAM-$VERSION
+tar xvf $CWD/$PRGNAM-$VERSION.tar.xz
+cd $PRGNAM-$VERSION
+chown -R root:root .
+find -L . -perm /111 -a \! -perm 755 -a -exec chmod 755 {} \+ -o \
+ \! -perm /111 -a \! -perm 644 -a -exec chmod 644 {} \+
+
+# As written, the code expects to run from its own directory.
+# Patch does these things:
+# - Add #!/usr/bin/perl to the executable. Seriously, upstream?
+# - Look for perl modules, icons, dictionaries under /usr/share
+# - Load/save config and dictionary cache in ~/.config/ScrabbleAI
+# - Use network order (architecture neutral) for perl Storables,
+# so the settings and library from ~/.config/ScrabbleAI don't
+# depend on the arch that was used to create them. This matters
+# to me because I use the same /home for both 32-bit and 64-bit
+# on my test box.
+patch -p1 < $CWD/unix.diff
+
+mkdir -p $PKG/usr/games $PKG/usr/share/games/$PRGNAM
+install -m0755 $PRGNAM.pl $PKG/usr/games/$PRGNAM
+cp -a lib/ScrabbleAI $PKG/usr/share/games/$PRGNAM
+
+HICOLOR=$PKG/usr/share/icons/hicolor
+ICON=$HICOLOR/64x64/apps/$PRGNAM.png
+mkdir -p "$( dirname $ICON )"
+
+# Upstream icon is 62x63, center in a 64x64 image:
+convert -background none -extent 64x64 -gravity center \
+ lib/ScrabbleAI/GUI/images/s_tile.png \
+ $ICON
+
+# Now create smaller ones from that:
+for i in 16 22 32 48; do
+ size=${i}x${i}
+ dir=$HICOLOR/$size/apps
+ mkdir -p $dir
+ convert -resize $size $ICON $dir/$PRGNAM.png
+done
+
+mkdir -p $PKG/usr/share/pixmaps
+ln -s ../icons/hicolor/48x48/apps/$PRGNAM.png $PKG/usr/share/pixmaps/$PRGNAM.png
+
+# .desktop file written by SlackBuild author.
+mkdir -p $PKG/usr/share/applications
+cat $CWD/$PRGNAM.desktop > $PKG/usr/share/applications/$PRGNAM.desktop
+
+# Man page written by SlackBuild author. It contains my own observations
+# since upstream didn't include much documentation.
+mkdir -p $PKG/usr/man/man6
+gzip -9c < $CWD/$PRGNAM.6 > $PKG/usr/man/man6/$PRGNAM.6.gz
+
+# Include links to the wordlists (*.txt) in the doc dir.
+# Do NOT include README.md: everything in it has been copied to
+# the man page, minus the Ubuntu and Fedora instructions.
+PKGDOC=$PKG/usr/doc/$PRGNAM-$VERSION
+mkdir -p $PKGDOC
+cp -a LICENSE $PKGDOC
+ln -s ../../share/games/scrabbleai/ScrabbleAI/Backend/ospd.txt $PKGDOC
+ln -s ../../share/games/scrabbleai/ScrabbleAI/Backend/enable.txt $PKGDOC
+cat $CWD/$PRGNAM.SlackBuild > $PKGDOC/$PRGNAM.SlackBuild
+
+mkdir -p $PKG/install
+cat $CWD/slack-desc > $PKG/install/slack-desc
+cat $CWD/doinst.sh > $PKG/install/doinst.sh
+
+cd $PKG
+/sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.$PKGTYPE
diff --git a/games/scrabbleai/scrabbleai.desktop b/games/scrabbleai/scrabbleai.desktop
new file mode 100644
index 0000000000000..737701b2c8c02
--- /dev/null
+++ b/games/scrabbleai/scrabbleai.desktop
@@ -0,0 +1,9 @@
+[Desktop Entry]
+Name=ScrabbleAI
+GenericName=Crossword Game
+Comment=Game similar to Scrabble(tm)
+Exec=/usr/games/scrabbleai
+Icon=scrabbleai
+Terminal=false
+Type=Application
+Categories=Game;BoardGame
diff --git a/games/scrabbleai/scrabbleai.info b/games/scrabbleai/scrabbleai.info
new file mode 100644
index 0000000000000..f391c80d67fe8
--- /dev/null
+++ b/games/scrabbleai/scrabbleai.info
@@ -0,0 +1,10 @@
+PRGNAM="scrabbleai"
+VERSION="20150324_6f8db6b"
+HOMEPAGE="https://github.com/apikler/ScrabbleAI"
+DOWNLOAD="https://slackware.uk/~urchlay/src/scrabbleai-20150324_6f8db6b.tar.xz"
+MD5SUM="8573b5b67336d7fdecbae8dbfdcc00ce"
+DOWNLOAD_x86_64=""
+MD5SUM_x86_64=""
+REQUIRES="perl-gtk2 perl-gnome2-canvas"
+MAINTAINER="B. Watson"
+EMAIL="urchlay@slackware.uk"
diff --git a/games/scrabbleai/scrabbleai.rst b/games/scrabbleai/scrabbleai.rst
new file mode 100644
index 0000000000000..803d868f3a4d1
--- /dev/null
+++ b/games/scrabbleai/scrabbleai.rst
@@ -0,0 +1,154 @@
+.. RST source for scrabbleai(6) man page. Convert with:
+.. rst2man.py scrabbleai.rst > scrabbleai.6
+
+.. |version| replace:: 20150324_6f8db6b
+.. |date| date::
+
+==========
+scrabbleai
+==========
+
+-----------------
+Scrabble[TM] game
+-----------------
+
+:Manual section: 6
+:Manual group: SlackBuilds.org
+:Date: |date|
+:Version: |version|
+
+SYNOPSIS
+========
+
+**scrabbleai**
+
+DESCRIPTION
+===========
+
+**scrabbleai** is an application for Linux that lets you play
+the popular word game against a computer opponent at varying
+difficulties. It has a graphical user interface, and is played with
+the mouse and keyboard.
+
+There is no way to play against another human, either locally or
+via the network. This is strictly a single-player game.
+
+There are no command-line options.
+
+GAMEPLAY
+========
+
+At startup, or after choosing **New Game** from the **File** menu, choose
+a difficulty level (1 to 10; default is 5), then click **Start Game**.
+
+You (the human) always go first. If you don't like this, you can click
+**Pass Turn** to make the AI play first. Remember that on the first
+turn, you have to place one of your tiles on the center square of the
+board.
+
+On your turn, use the mouse to drag letter tiles onto the board
+to spell out a word in the usual Scrabble fashion. Your move isn't
+finalized until you click **Make Move** and the game decides your word
+is valid. Until then, you can move your tiles around as desired, or
+click **Return Tiles to Rack** to start over.
+
+When placing a blank tile, you'll be prompted to right-click on it and
+set the letter it represents. If you return the blank tile to the rack
+after doing this, don't forget to right-click on it and press Space,
+to make it appear blank again. If you forget which tile was the blank
+one, it's the one with no score number in the lower-right corner.
+
+If your rack is empty at the end of the game, you still get a turn;
+you must click **Pass Turn** to end the game. When the game is over,
+click **File** => **New Game** to start a new one.
+
+NOTES
+=====
+
+Note that the first time you start a new game, it will take
+longer than usual to launch as the dictionary is cached for future
+use. Subsequent games (even after relaunching the program) will be
+able to skip this step and start up faster.
+
+The AI is based on an algorithm from a paper written by Andrew
+W. Appel and Guy J. Jacobson, which you can find here::
+http://www.cs.cmu.edu/afs/cs/academic/class/15451-s06/www/lectures/scrabble.pdf
+
+The AI is *really* good. However many words you know, it knows
+more. On level 5, the AI beats the author of this man page about 50%
+of the time, with final scores averaging above 250. The original
+Scrabble rules say that a good player should be able to score 300, so
+your mileage may vary.
+
+If you want to peek at the dictionary, there are two of them located
+in /usr/doc/scrabbleai-|version|/. **enable.txt** is used to validate
+your words, and a smaller **ospd.txt** is used for the computer's
+words.
+
+The game board is the standard 15x15 version, with the bonus squares
+in the regular locations. There's no way to customize the board or the
+tile distribution.
+
+SCREENSHOTS
+===========
+
+The intro screen: https://apikler.github.io/ScrabbleAI/intro_screen.png
+
+The main game screen: https://apikler.github.io/ScrabbleAI/game_screen.png
+
+A completed game: https://apikler.github.io/ScrabbleAI/finished_game.png
+
+The help dialog: https://apikler.github.io/ScrabbleAI/help_dialog.png
+
+VIDEOS
+======
+
+The AI makes a move: https://apikler.github.io/ScrabbleAI/ai_move.html
+
+Resizing the window: http://apikler.github.io/ScrabbleAI/resize.html
+
+FILES
+=====
+
+The directory **~/.config/ScrabbleAI/** contains the settings and
+cached dictionary, as **perl**\(1) **Storable**\(3) files, which
+means they're not human-reable or -editable. If the directory or its
+contents do not exist at startup, **scrabbleai** will create them.
+
+**settings**
+ Application settings: default difficulty, window size and position.
+
+**library**
+ Cached dictionary, used to speed program startup.
+
+COPYRIGHT
+=========
+
+See the file /usr/doc/scrabbleai-|version|/LICENSE for license information.
+
+AUTHORS
+=======
+
+scrabbleai was written by apikler (GitHub username).
+
+This man page written for the SlackBuilds.org project
+by B. Watson, and is licensed under the WTFPL.
+
+DISCLAIMER
+==========
+
+This program is free, not for profit, and for educational purposes
+only. Any usage of elements from the Scrabble board game is provided
+only to illustrate the functioning of the AI. Scrabble is a registered
+trademark belonging to Hasbro Inc in the US, and to J.W. Spear &
+Sons Ltd., a subsidiary of Mattel Inc., throughout the rest of the
+world. Neither the author nor this program are affiliated with the
+Scrabble Crossword Game, Hasbro, Spear & Sons, or Mattel in any
+fashion.
+
+SEE ALSO
+========
+
+The scrabbleai homepage: https://github.com/apikler/ScrabbleAI
+
+The Wikipedia entry on Scrabble: https://en.wikipedia.org/wiki/Scrabble
diff --git a/games/scrabbleai/slack-desc b/games/scrabbleai/slack-desc
new file mode 100644
index 0000000000000..1d5cfc4b23510
--- /dev/null
+++ b/games/scrabbleai/slack-desc
@@ -0,0 +1,19 @@
+# HOW TO EDIT THIS FILE:
+# The "handy ruler" below makes it easier to edit a package description.
+# Line up the first '|' above the ':' following the base package name, and
+# the '|' on the right side marks the last column you can put a character in.
+# You must make exactly 11 lines for the formatting to be correct. It's also
+# customary to leave one space after the ':' except on otherwise blank lines.
+
+ |-----handy-ruler------------------------------------------------------|
+scrabbleai: scrabbleai (Scrabble[TM] game for Linux)
+scrabbleai:
+scrabbleai: scrabbleai is an application for Linux that lets you play the popular
+scrabbleai: word game against a computer opponent at varying difficulties.
+scrabbleai:
+scrabbleai:
+scrabbleai:
+scrabbleai:
+scrabbleai:
+scrabbleai:
+scrabbleai:
diff --git a/games/scrabbleai/unix.diff b/games/scrabbleai/unix.diff
new file mode 100644
index 0000000000000..945a80989a88b
--- /dev/null
+++ b/games/scrabbleai/unix.diff
@@ -0,0 +1,97 @@
+diff -Naur scrabbleai-20150324_6f8db6b/lib/ScrabbleAI/Backend/Library.pm scrabbleai-20150324_6f8db6b.patched/lib/ScrabbleAI/Backend/Library.pm
+--- scrabbleai-20150324_6f8db6b/lib/ScrabbleAI/Backend/Library.pm 2023-03-20 18:35:20.752358098 -0400
++++ scrabbleai-20150324_6f8db6b.patched/lib/ScrabbleAI/Backend/Library.pm 2023-03-20 23:37:16.993653190 -0400
+@@ -25,7 +25,7 @@
+ use warnings;
+
+ use Data::Dumper;
+-use Storable;
++use Storable qw(nstore retrieve);
+
+ use ScrabbleAI::Backend::Utils;
+ use ScrabbleAI::Backend::Node;
+@@ -38,7 +38,7 @@
+ use constant {
+ OSPD => ScrabbleAI::Backend::Utils::abs_path('Backend/ospd.txt'),
+ ENABLE => ScrabbleAI::Backend::Utils::abs_path('Backend/enable.txt'),
+- LIBRARY => ScrabbleAI::Backend::Utils::abs_path('Backend/library'),
++ LIBRARY => "$ENV{HOME}/.config/ScrabbleAI/library",
+ };
+
+ # If a Backend/Library file exists, attempts to load the Library from it using Storable.
+@@ -76,7 +76,7 @@
+ $self->{treewords}{$word} = 1;
+ }
+
+- store({
++ nstore({
+ wordtree => $self->{wordtree},
+ treewords => $self->{treewords},
+ longwords => $self->{longwords},
+diff -Naur scrabbleai-20150324_6f8db6b/lib/ScrabbleAI/Backend/Utils.pm scrabbleai-20150324_6f8db6b.patched/lib/ScrabbleAI/Backend/Utils.pm
+--- scrabbleai-20150324_6f8db6b/lib/ScrabbleAI/Backend/Utils.pm 2023-03-20 18:35:20.752358098 -0400
++++ scrabbleai-20150324_6f8db6b.patched/lib/ScrabbleAI/Backend/Utils.pm 2023-03-20 20:45:44.221621837 -0400
+@@ -23,8 +23,6 @@
+ use strict;
+ use warnings;
+
+-use FindBin;
+-
+ # Given an arrayref of coordinates '(i,j)' and a position 0 or 1,
+ # returns an array of only the coordinates of that position.
+ sub coord_position {
+@@ -80,7 +78,7 @@
+ sub abs_path {
+ my ($path) = @_;
+
+- return $FindBin::Bin . "/lib/ScrabbleAI/$path";
++ return "/usr/share/games/scrabbleai/ScrabbleAI/$path";
+ }
+
+ 1;
+diff -Naur scrabbleai-20150324_6f8db6b/lib/ScrabbleAI/GUI/SettingsManager.pm scrabbleai-20150324_6f8db6b.patched/lib/ScrabbleAI/GUI/SettingsManager.pm
+--- scrabbleai-20150324_6f8db6b/lib/ScrabbleAI/GUI/SettingsManager.pm 2023-03-20 18:35:20.764358097 -0400
++++ scrabbleai-20150324_6f8db6b.patched/lib/ScrabbleAI/GUI/SettingsManager.pm 2023-03-20 23:37:24.279652505 -0400
+@@ -28,10 +28,10 @@
+ use ScrabbleAI::Backend::Utils;
+
+ use Data::Dumper;
+-use Storable;
++use Storable qw(nstore retrieve);
+
+ # File where the settings are saved
+-use constant FILENAME => ScrabbleAI::Backend::Utils::abs_path('GUI/settings');
++use constant FILENAME => "$ENV{HOME}/.config/ScrabbleAI/settings";
+
+ # Creates a new instance of this class; if the settings file exists on disk,
+ # loads the settings (key => value pairs as a hashref) from that file.
+@@ -90,7 +90,7 @@
+ sub save {
+ my ($self) = @_;
+
+- store($self->{settings}, FILENAME);
++ nstore($self->{settings}, FILENAME);
+ }
+
+ 1;
+diff -Naur scrabbleai-20150324_6f8db6b/scrabbleai.pl scrabbleai-20150324_6f8db6b.patched/scrabbleai.pl
+--- scrabbleai-20150324_6f8db6b/scrabbleai.pl 2023-03-20 18:35:20.764358097 -0400
++++ scrabbleai-20150324_6f8db6b.patched/scrabbleai.pl 2023-03-20 20:52:53.461581441 -0400
+@@ -1,3 +1,5 @@
++#!/usr/bin/perl
++
+ ##########################################################################
+ # ScrabbleAI
+ # A program that lets you play the popular word game Scrabble against a
+@@ -22,8 +24,9 @@
+ use strict;
+ use warnings;
+
+-use FindBin;
+-use lib $FindBin::Bin . '/lib';
++system("mkdir -p $ENV{HOME}/.config/ScrabbleAI");
++
++use lib '/usr/share/games/scrabbleai';
+
+ use Gtk2 '-init';
+