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
Simulate a Monopoly game to generate the probabilities of landing on each square.

Monopoly-Probabilities Simulate a Monopoly game to generate the probabilities of landing on each square. While this project originally was inspired by

George Waters 2 Jan 04, 2023
Jiminy, fast and portable Python/C++ simulator of poly-articulated systems with OpenAI Gym interface for reinforcement learning.

Jiminy is a fast and portable cross-platform open-source simulator for poly-articulated systems. It was built with two ideas in mind: provide a fast y

Alexis DUBURCQ 122 Dec 29, 2022
This is a script which can be used to autobattle, upgrade metamon, compose eggs and open eggs in metamon game.

This is a script which can be used to autobattle, upgrade metamon, compose eggs and open eggs in metamon game. The only parameters you need to input are you wallet address and sign. The sign can be o

Taxiria 37 May 11, 2022
A Cataclysm: Dark Days Ahead launcher with additional features

CDDA Game Launcher A Cataclysm: Dark Days Ahead launcher with additional features. Download here. Implemented features Launching the game Detecting th

Rémy Roy 402 Jan 02, 2023
This is a python implementation of wordle, which uses the same set of available words as the hit game, Wordle

Wordle Game This is a python implementation of wordle, which uses the same set of available words as the hit game, Wordle. Play the game manually pyth

Pierre Theo Klein 11 Mar 04, 2022
Launch any Heroic-Games-Launcher game using bash scripts without having to open Heroic.

HeroicBashLauncher Ever wanted to launch your EGS games installed through Heroic Games Launcher directly from the terminal, Lutris or any other fronte

288 Dec 27, 2022
A popular children's game developed in Python.

Pedra Papel e Tesoura Um dos jogos mais populares da infância... 🪨 📜 ✂️ 💻 Situação do projeto: Projeto finalizado ✔️ 🛠 Tecnologias: Python Tkinter

Arthur V.B.S. 2 Dec 05, 2022
TetrisAI - Tetris AI Bot using computer vision to play game automatically

Tetris AI Tetris AI Bot using computer vision to play game automatically bot.py

11 Aug 29, 2022
EL JUEGO DEL GUSANITO

EL JUEGO DEL GUSANITO El juego consiste en una línea que no para de moverse, el usuario lo controla con las flechas de: → derecha ← izquierda ↑ arriba

Valeria Saidid Miranda Ibarra 0 Dec 19, 2021
MCTS (among other things) for 2048

2048 Created by Chad Palmer for CPSC 474, Fall 2021 Overview: This is an application which can play 2048 and simulate games of 2048 with a variety of

Chad Palmer 1 Dec 16, 2021
uses Entropy to find the best next guess for Wordle, given the color clues

WordleSolver uses Entropy to find the best next guess for Wordle, given the color clues use player.py and enter in the string for the suggested clue w

Steve Earth 1 Jan 26, 2022
A small game I made back in think 2011

Navi Network A small game I made back in think 2011. An online game inspired by the self-hosted nature of Minecraft, made with pygame, based on the Me

Peder Bergebakken Sundt 2 Jan 19, 2022
An interactive pygame implementation of Conway's Game of Life

Game of Life An interactive pygame implementation of Conway's Game of Life Installation Clone the repo and navigate into it. git clone https://github.

Ethan 1 Dec 05, 2021
Wordle-prophecy - The comprehensive list of all Wordle answers, past and future

About This repo contains the comprehensive list of all Wordle answers, past and

Hayden Moritz 2 Dec 15, 2022
🐥Flappy Birds🐤 Video game. With your help I can go through🚀 the pipes. All UI is made with 🐍Pygame🐍

🐠 Flappy Fish 🐢 I am Flappy Fish 🐟 . With your help I can jump through the pipes and experience an interesting and exciting flight deep into the fi

MohammadReza 2 Jan 14, 2022
Simple Covid-19 shooter game in python.

Covid_game 🍹 Simple Single Player Covid Game Using Python. 🍹 Has amazing background music theme. 😄 Game Instructions: Initial Health is 5, try to s

Tanya Yadav 2 Aug 05, 2022
python script to convert .OBJ files into Minecraft, rendering them in game with a core shader.

samples: random notes about the tool general output format: (animation not supported yet but planned) vertex id Minecraft's gl_VertexID isn't per mode

199 Jan 02, 2023
Easily manage wine prefixes in a new way. Run Windows software and games on Linux

Bottles Easily manage wineprefix using environments Documentation · Forums · Telegram group · Funding 📚 Documentation Before opening a new issue, che

Bottles 4.1k Jan 09, 2023
Simplerpg - python terminal game made from scratch.

Simplerpg - python terminal game made from scratch.

reversee 3 Sep 17, 2022
Memory game in Python

Concentration - Memory Game Concentration is a memory game written in Python, inspired by memory-game. Description As stated in the introduction of th

Marco Colonna 0 Jul 21, 2022