Netskrafl - an Icelandic crossword game website

Overview

Netskrafl - an Icelandic crossword game website

Join the chat at https://gitter.im/Netskrafl/Lobby

English summary

This repository contains the implementation of an Icelandic crossword game in the genre of SCRABBLE(tm). The game, which is free-to-play, is accessible on the web at https://netskrafl.is.

Screenshot from mobile UI

The game backend is implemented in Python 3.8 for the Google App Engine Standard Environment.

The frontend is a tablet- and smartphone-friendly web client in HTML5 and JavaScript connecting via Ajax to a Flask-based web server on the backend.

The game contains a robot crossword player written in Python. The algorithm is based on Appel & Jacobson's classic paper "The World's Fastest Scrabble Program". At maximum strength level, the robot always plays the highest-scoring move possible but additional and alternative strategies can be plugged in relatively easily. At the lowest strength level, the robot is limited to a set of common words, about a quarter of the size of the entire word database.

The software has a range of features such as immediate tile-by-tile feedback on word validity and score, real-time synchronized games with clocks, Elo scoring of players, an online chat window, and the ability to view player track records.

The game uses a word database encoded in a Directed Acyclic Word Graph (DAWG). For Icelandic, the graph contains almost 2.3 million word forms. Further information about the DAWG implementation can be found in README.md in the Skrafl repository on GitHub.

The game mechanics are mostly found in skraflmechanics.py.

The robot player is implemented in skraflplayer.py.

The DAWG navigation code is in dawgdictionary.py.

Language-specific tile sets, bags and vocabularies are handled in languages.py.

The main Flask web server is in netskrafl.py.

The Game and User classes are found in skraflgame.py and skrafluser.py, respectively.

The persistence layer, using the schemaless App Engine NDB database, is in skrafldb.py.

The client JavaScript code is in static/netskrafl.js.

The various Flask HTML templates are found in templates/*.html.

The DAWG-compressed vocabularies are stored in resources/*.bin.dawg.

To build and run locally

Follow these steps:

  1. Install Python 3.8, possibly in a virtualenv.

  2. Download the Google App Engine SDK (GAE) for Python and follow the installation instructions.

  3. git clone https://github.com/mideind/Netskrafl to your GAE application directory.

  4. Run pip install -r requirements.txt in your virtualenv to install required Python packages so that they are accessible to GAE.

  5. Run python dawgbuilder.py to generate the DAWG *.bin.dawg files. This may take a couple of minutes.

  6. Create a secret session key for Flask in resources/secret_key.bin (see How to generate good secret keys, you need to scroll down to find the heading).

  7. Install Node.js if you haven't already. Run npm install to install Node dependencies.

  8. In a separate terminal window, but in the Netskrafl directory, run grunt make. Then run grunt to start watching changes of js and css files.

  9. Run either runserver.bat or runserver.sh.

Or, alternatively:

Run ./setup-dev.sh (tested on Debian based Linux and OS X).

Generating a new vocabulary file

To generate a new vocabulary file (ordalisti.full.sorted.txt), assuming you already have the BÍN database in PostgreSQL (here in table sigrunarsnid - remember to use the is_IS collation locale!), invoke psql, log in to your database and create the following view:

create or replace view skrafl as
   select stofn, utg, ordfl, fl, ordmynd, beyging from sigrunarsnid
   where ordmynd ~ '^[aábdðeéfghiíjklmnoóprstuúvxyýþæö]{3,15}$'
   and fl <> 'bibl'
   and not ((beyging like 'SP-%-FT') or (beyging like 'SP-%-FT2'))
   order by ordmynd;

To explain, this extracts all 3-15 letter word forms containing only Icelandic lowercase alphabetic characters, omitting the bibl (Biblical) category (which contains mostly obscure proper names and derivations thereof), and also omitting plural question forms (spurnarmyndir í fleirtölu).

Then, to generate the vocabulary file from the psql command line:

\copy (select distinct ordmynd from skrafl) to '/home/username/github/Netskrafl/resources/ordalisti.full.sorted.txt';

To extract only the subset of BÍN used by the robot Miðlungur, use the following view, assuming you have the Kristínarsnið form of BÍN in the table kristinarsnid containing the malsnid and einkunn columns:

create or replace view skrafl_midlungur as
	select stofn, utg, ordfl, fl, ordmynd, beyging
	from kristinarsnid
	where (malsnid is null or (malsnid <> ALL (ARRAY['SKALD', 'FORN', 'URE', 'STAD'])))
		and einkunn > 0;

You can then use the skrafl_midlungur view as the underlying table for the previous (vocabulary) query, replacing sigrunarsnid with skrafl_midlungur.

Original Author

Vilhjálmur Þorsteinsson, Reykjavík, Iceland.

Contact me via GitHub for queries or information regarding Netskrafl.

Please contact me if you have plans for using Netskrafl as a basis for your own game website and prefer not to operate under the conditions of the CC-BY-NC 4.0 license (see below).

License

Netskrafl - an Icelandic crossword game website

Copyright © 2021 Miðeind ehf.

This set of programs is licensed under the Creative Commons Attribution-NonCommercial 4.0 International Public License (CC-BY-NC 4.0).

The full text of the license is available here: https://creativecommons.org/licenses/by-nc/4.0/legalcode.

Included third party software

Netskrafl contains the DragDropTouch.js module by Bernardo Castilho, which is licensed under the MIT license as follows:

Copyright © 2016 Bernardo Castilho

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

Netskrafl contains the jQuery UI Touch Punch library by David Furfero, which is licensed under the MIT license.

Copyright © 2011 David Furfero

The MIT license, as spelled out above, applies to this library.

Trademarks

SCRABBLE is a registered trademark. This software or its author are in no way affiliated with or endorsed by the owners or licensees of the SCRABBLE trademark.

Comments
  • Útreikningur á refsingu fyrir ónýtta stafi virðist vera rangur

    Útreikningur á refsingu fyrir ónýtta stafi virðist vera rangur

    2 * KNVN = 18 en á, að ég held að vera 2 * KNVN = 20.

    Sjá mynd: http://www.tiikoni.com/tis/view/?id=b73dc7c

    Ég er voða ánægður með að hafa sloppið við ósigur :)

    invalid 
    opened by acmeguy 4
  • Dawgbuilder virkar ekki á OS X

    Dawgbuilder virkar ekki á OS X

    Þegar ég keyri python dawgbuilder.py á OS X fæ ég viðvaranir um að röðun sé ekki rétt. Hér virðist vera um að ræða sérstakt vandamál á OS X sem leysist ekki við að skipta um locale.

    Ath: Ég er með lausn á þessu og mun senda pull request bráðlega.

    Fyrst taldi ég að villan væri vegna þess að ég hefði ekki valið rétt locale, en það virðist hreinlega ekki vera rétt röðun á stýrikerfinu, a.m.k. með þeim pökkum sem ég er með núna.

    Hér má sjá raðanir á "abbadísunum,abbaðist,abbast" notandi allar mögulegar is_IS stillingar á mínu kerfi:

    Locale: is_IS
    abbadísunum,abbast,abbaðist - NOK
    Locale: is_IS.ISO8859-1
    abbaðist,abbadísunum,abbast - NOK
    Locale: is_IS.ISO8859-15
    abbaðist,abbadísunum,abbast - NOK
    Locale: is_IS.UTF-8
    abbadísunum,abbast,abbaðist - NOK
    

    Hér er umræða um þetta vandamál: http://stackoverflow.com/questions/3412933/python-not-sorting-unicode-properly-strcoll-doesnt-help

    Þar er rætt um að nota PyICU í staðinn. Lausnin sem ég er með núna gerir það raunar ekki, en ég mun prófa það áður en ég sendi pull request, þar sem það myndi virka fyrir önnur tungumál en íslensku.

    Forritið virkaði raunar ekki heldur á Ubuntu, en þar leystist það við að velja locale=is_IS.utf8. Almennt getur verið bölvað vesen að fá locale til að virka í almenna tilfellinu svo pull requestið bætir við aukalegu villutékki og boðið er upp á möguleg locale á skipanalínunni.

    opened by withrocks 4
  • Modularize the javascript files

    Modularize the javascript files

    • The files main.js, netskrafl.js and watch.js are using duplicated code
    • Use grunt concat to concatenate different modules
    • Add grunt-contrib-concat, provides the concat task
    • Update the gruntfile accordingly
    • Move code from e.g. static/netskrafl.js to static/js/netskrafl.js, then separate common code to separate files
    • Order changes in some cases, should not matter, but needs testing
    • Not fully tested yet, needs to be tested by project owner
    opened by withrocks 3
  • Sýna í leik og í leikjalista hvort andstæðingur skraflar án hjálpartækja

    Sýna í leik og í leikjalista hvort andstæðingur skraflar án hjálpartækja

    Það sést ekki í leik hvort andstæðingurinn sver af sér hjálpartæki eður ei. Ég stundaði það því að fara út í leikjalistann til að gá, en með síðustu uppfærslu hætti það að sjást þar líka. Mér sýnist að það sjáist núna hvergi nema með því að fara í „Andstæðingar“ og hafa þar uppi á nafni andstæðingsins (og þar er engin leit, bara listar í stafrófsröð þar sem greint er á milli hástafa og lágstafa).

    Þetta er til baga fyrir miðjumoðara eins og mig sem hafa þann háttinn á að banna sér hjálpartæki bara í leikjum á móti öðrum sem banna sér þau, en leyfa sér þau á móti öðrum sem leyfa sér þau. (Og raunar mætti alveg vera til sú yfirlýsing líka — eða þá að yfirlýsingin geti átt við um einstaka leiki.)

    Best væri að gefa þetta til kynna bæði í leik og í leikjalista.

    invalid 
    opened by gthb 3
  • ELO-stigakerfi eða sambærilegt; sjálfvirk pörun leikmanna

    ELO-stigakerfi eða sambærilegt; sjálfvirk pörun leikmanna

    Nota ELO-kerfið eða annað sambærilegt kerfi til að reikna út stig leikmanna. Sýna lista yfir leikmenn í lækkandi ELO-röð. Bjóða upp á sjálfvirka áskorun þar sem kerfið parar leikmann við annan leikmann í svipuðum styrkleikaflokki sem er álínis og til í slíkt (merktur þannig í notendaupplýsingum).

    enhancement 
    opened by vthorsteinsson 2
  • Meira áberandi tilkynning um ný spjallskilaboð

    Meira áberandi tilkynning um ný spjallskilaboð

    Ný spjallskilaboð eru nú gefin til kynna með litabreytingu á spjallteikni úr svörtu í rautt. Fyrir litblinda eða sjóndapra getur verið erfitt að sjá þessa breytingu.

    enhancement 
    opened by vthorsteinsson 1
  • Sýna bestu orð og stigahæstu viðureignir í ferils-gluggum

    Sýna bestu orð og stigahæstu viðureignir í ferils-gluggum

    Sýna bæði besta orð og hæsta skor leikmannsins sjálfs í ferilsflipa, og andstæðinga í ferilsglugga þeirra. Innifela tengil (krækju) í viðkomandi viðureign.

    enhancement 
    opened by vthorsteinsson 1
  • Skoða feril andstæðings beint frá viðureign

    Skoða feril andstæðings beint frá viðureign

    Geta skoðað feril andstæðings með auðveldum hætti beint frá viðureignarborði, í stað þess að þurfa að leita að honum í andstæðingalistum. Gæti einnig tengst möguleika á að sjá yfirlit um fyrri viðureignir við sama andstæðing.

    enhancement 
    opened by vthorsteinsson 1
  • Geyma stöðu borðs milli innlita

    Geyma stöðu borðs milli innlita

    Geyma flísar á sínum stað á borði (og í réttri röð í rekka) milli þess sem viðureignir eru opnaðar í board.html. Hjálpar leikmönnum að muna hugmyndir að leikjum. Væntanlega yrði að leysa þetta með localStorage sem þýðir að kerfið man stöðuna aðeins á sama vefrápara á sömu tölvu eða tæki. Hugsanlegt að bæta einnig við "minnisblaði" - nýjum flipa við borðið - þar sem unnt yrði að geyma hugrenningar og hugmyndir um lagnir.

    enhancement 
    opened by vthorsteinsson 1
  • Sjá útistandandi viðureignir og skipta á milli þeirra beint frá borði

    Sjá útistandandi viðureignir og skipta á milli þeirra beint frá borði

    Geta frá borðinu (board.html) séð einhvers konar fellilista yfir viðureignir þar sem leikmaður á leik og geta skipt beint á milli þeirra án þess að fara út í main.html og til baka.

    enhancement 
    opened by vthorsteinsson 1
  • Leikur andstæðings færi hvorki flísar aftur í rekka né rugli rekkanum

    Leikur andstæðings færi hvorki flísar aftur í rekka né rugli rekkanum

    Leikmaður hefur e.t.v. lagt tíma og vinnu í að finna möguleg orð og staðsetningar sem sárt er að sjá verða að engu þegar leikur andstæðings birtist, sérstaklega í tímaleik. Þó yrði augljóslega að senda nýjar flísar sem eru fyrir á reitum sem andstæðingur leggur á niður í rekkann.

    enhancement 
    opened by vthorsteinsson 1
  • Calculate and display player point averages over last N games

    Calculate and display player point averages over last N games

    Currently player point averages are calculated over the player's entire game history. A useful complement to this would be an average over only the last N games, where N is perhaps 100.

    enhancement 
    opened by vthorsteinsson 0
  • Allow double click on blank tile to set a new meaning

    Allow double click on blank tile to set a new meaning

    When composing a word on the board using a blank tile, allow the user to double click on the tile to modify its meaning, instead of having to return it to the rack and then back again to the original location.

    enhancement 
    opened by vthorsteinsson 0
  • Rangur hjálpartexti: „Flísar sem eftir eru í pokanum“

    Rangur hjálpartexti: „Flísar sem eftir eru í pokanum“

    Þegar músin vokir yfir stafaflísunum neðst til hægri stendur í hjálpartexta „Flísar sem eftir eru í pokanum“. En flísarnar sem þegar eru komnar á rekka andstæðingsins eru þarna á meðal, og þær flísar munu ekki koma úr pokanum. Raunin er því önnur en textinn heldur fram. (Og það er eins gott, því að annars væri alltaf hægt að þefa uppi hvaða flísar andstæðingurinn dregur með því að fylgjast vel með þessum lista breytast!)

    Réttari texti væri því „Flísar í pokanum eða á rekka andstæðingsins”, eða bara „Flísar sem eftir eru“.

    opened by gthb 0
  • Merkja leikmenn sem eru andstæðingar í viðureignum sem standa yfir

    Merkja leikmenn sem eru andstæðingar í viðureignum sem standa yfir

    Leikmenn með útistandandi áskorun eru merktir með rauðum fingri. Bæta mætti við grænum fingri (eða álíka merki) á þá leikmenn sem eru andstæðingar í viðureignum sem standa yfir.

    enhancement 
    opened by vthorsteinsson 0
  • Merking áskorana frá leikmönnum sem nota hjálpartæki

    Merking áskorana frá leikmönnum sem nota hjálpartæki

    Sumir leikmenn vilja helst eða alls ekki taka áskorunum frá leikmönnum sem nota hjálpartæki. Viðmótið mætti vera skýrara til að aðgreina slíkar áskoranir. Jafnvel mætti hafa sérstakan rabbglugga til staðfestingar þegar leikmaður tekur slíkri áskorun.

    enhancement 
    opened by vthorsteinsson 0
Releases(mfix3)
  • mfix3(Sep 5, 2022)

    Mfix2 + patches including updated word lists and cherry picked bug fixes, plus updated copyright info and a fix to the SalesCloud wrapper div style

    Source code(tar.gz)
    Source code(zip)
  • BeforeExplo(Jul 9, 2021)

    This is a release that encompasses Netskrafl before a large merge with the Explo codebase, where code has been moved to the /src directory, the backend endpoints split into web.py and api.py, and the UI migrated to a single-page UI written in TypeScript.

    Source code(tar.gz)
    Source code(zip)
  • mfix(Jan 25, 2021)

    • Vocabulary fixes
    • Fixed code for reading games from the database. ResponseMoves were being read in such a manner that word validity at the time of reading was used as the ground truth, not the word validity as it was when the original move was made. This affected manual wordcheck games that were in progress while the vocabulary was being changed to be more restrictive - and then back again to being more permissive.
    Source code(tar.gz)
    Source code(zip)
  • median(Jan 20, 2021)

    • Backtracked change in main dictionary; it now includes the same subset of BÍN as before (basically everything except 'bibl' and plural question forms)
    • Changed the Miðlungur robot to use a separate vocabulary, similar to what Amlóði does
    • Added tests
    • Removed extraneous indexes from the RatingModel datastore entities
    • Added separate accounting of Elo points for manual-wordcheck games (not yet enabled in the UI)
    Source code(tar.gz)
    Source code(zip)
  • ksnid(Jan 13, 2021)

    • Updated dictionary from newest version of BÍN using "Kristínarsnið"
    • Removed ~130.000 rare, localized, poetic, old or misspelled word forms from dictionary
    • Moved to Python 3.8 runtime
    • Type annotations added
    Source code(tar.gz)
    Source code(zip)
  • Vocabfix3(Jul 22, 2020)

  • Vocabfix2(Apr 16, 2020)

  • Punchfix.1(Nov 26, 2019)

  • Firefix.1(Oct 16, 2017)

  • Obelix.1(Sep 21, 2017)

  • snowfall.1(Dec 3, 2015)

    Performance enhancements, especially for user lists. Removed locale dependency in dawgbuilder.py, as locale functionality is pretty erratic between Win32/Linux/OSX.

    Source code(tar.gz)
    Source code(zip)
  • rekindle.1(Nov 5, 2015)

    Adds a two-click mode when placing tiles: click on the tile to move and then on an empty square to place it.

    Moves the recall-to-rack button to the left of the rack, away from the Play button, as users occasionally pressed Play when they intended to recall tiles.

    Adds a live user search field, based on user identifiers or full names, instead of the previous alphabet categories, which were getting quite unwieldy as the user base grew. This required two new properties on the UserModel in the database.

    Source code(tar.gz)
    Source code(zip)
  • Rebus(Oct 25, 2015)

  • Ramadan.1(Aug 11, 2015)

  • Kufti.1(Apr 20, 2015)

    Navigation between games directly from the board; ability to see opponent track record directly from board; FAQ in help; highest scoring word and highest game score stored with users; Elo score stored with users during stats calculation; other smaller enhancements.

    Source code(tar.gz)
    Source code(zip)
  • Omar.1(Apr 7, 2015)

Owner
Miðeind ehf
Icelandic startup specializing in AI and Natural Language Processing
Miðeind ehf
Mandaw 2 Mar 1, 2022
Snake game mixed with Conway's Game of Life

SnakeOfLife Snake game mixed with Conway's Game of Life The rules are the same than a normal snake game but you have to avoid cells created by Conway'

Aidan 5 May 26, 2022
Lint game data metafiles against GTA5.xsd for Rockstar's game engine (RAGE)

rage-lint Lint RAGE (only GTA5 at the moment) meta/XML files for validity based off of the GTA5.xsd generated from game code. This script accepts a se

GoatGeek 11 Sep 18, 2022
HTTP API for FGO game data. Transform the raw game data into something a bit more manageable.

FGO game data API HTTP API for FGO game data. Transform the raw game data into something a bit more manageable. View the API documentation here: https

Atlas Academy 51 Dec 26, 2022
A near-exact clone of google chrome's no internet game, or the "google dinosaur game", with some additions and extras.

dinoGame A near-exact clone of google chrome's no internet game, or the "google dinosaur game", with some additions and extras. Installation Download

null 1 Oct 26, 2021
Quantum version of the classical Nim game. An automatic opponent allows to game to not be as easy as it seems.

Nim game Running the game To run the program just launch : python3 game.py Rules This game is inspiring from the Nim game. You are 2 players face to f

Michaël 1 Jan 8, 2022
Average Clicker Game (AVG) is a Python made game using tkinter

Average-Clicker-Game Average Clicker Game (AVG) is a Python clicker game not made with pygame but with tkinter, it has worker, worker upgrades, times

Zacky2613 1 Dec 21, 2021
Ice-Walker-Game - This repository is about the Ice Walker game made in Python.

Ice-Walker-Game Ce dépot contient le jeu Ice Walker programmé en Python. Les différentes grilles du jeu sont contenues dans le sous-dossier datas. Vou

Mohamed Amine SABIL 1 Jan 2, 2022
Deal Or No Deal was a very popular game show. Even now, for a family party, it's a fun game to pass time

Deal Or No Deal was a very popular game show. Even now, for a family party, it's a fun game to pass time. I made a code to play the game right in your terminal/console. This isn't made to be a game which can be installed by everyone and played, I just made it as a fun project as I just started out with python. So if you have python installed and wanna have some fun, or just curious to see how I did this, feel free to check the code out!

null 1 Feb 15, 2022
Mastermind-Game - A game to test programming and logical skills

Bem vindo ao jogo Mastermind! O jogo consiste em adivinhar uma senha que será ge

Marcelo Daros 0 Jan 27, 2022
Quiz Game: answering questions naturally with a friendly UI to enjoy the game

About Quiz Game : The Game is about answering questions naturally with a friendl

null 4 Jan 19, 2022
This is a simple telegram bot for the game Pyal, a word guessing game inspired by Wordle

Pyal Telegram Bot This is a simple telegram bot for the game Pyal, a word guessing game inspired by Wordle. How does it work? Differently from the ori

Rafael Omiya 4 Oct 6, 2022
Adventure-Game - Adventure Game which is created using Python

Adventure Game ?? This is a Adventure Game which is created using Python. Featur

ArinjoyTheDev 1 Mar 19, 2022
Game-of-life - A simple python program to simulate and visualise the Conway's Game of life

Conway's game of life A simple python program to simulate and visualise the Conw

Dhravya Shah 3 Feb 20, 2022
An all-inclusive Python framework for the Riot Games League of Legends API. We focus on making the data easy and fun to work with, while providing all the tools necessary to create a website or do data analysis.

Cassiopeia A Python adaptation of the Riot Games League of Legends API (https://developer.riotgames.com/). Cassiopeia is the sister library to Orianna

Meraki Analytics 473 Jan 7, 2023
Minecraft clone using Python Ursina game engine!

Minecraft clone using Python Ursina game engine!

Taehee Lee 35 Jan 3, 2023
A Pygame game made in 48 hours

Flappuccino Flappuccino is a game created in 48 hours for the PyGame Community New Years Jam using Python with Pygame. Screenshots Background Informat

PolyMars 242 Jan 2, 2023
Open-source project written in the ursina engine, simulating the popular game Minecraft.

Voxelcraft is an open-source project written in the ursina engine, simulating the popular game Minecraft.

Calinescu Mihai 21 Oct 6, 2022
To solve games using AI, we will introduce the concept of a game tree followed by minimax algorithm.

To solve games using AI, we will introduce the concept of a game tree followed by minimax algorithm.

Vaibhaw 7 Oct 13, 2022