Giter Site home page Giter Site logo

pablo-meier / scrabblecheat Goto Github PK

View Code? Open in Web Editor NEW
6.0 6.0 2.0 31.53 MB

A helper for your Scrabbling woes.

Home Page: https://morepablo.com

License: GNU General Public License v3.0

C 11.43% Ruby 14.19% Erlang 43.59% JavaScript 0.80% Makefile 0.63% Thrift 1.02% Elm 19.36% HTML 0.07% Java 0.55% Kotlin 8.37%

scrabblecheat's Introduction

Hi! 👋

Picture of me and my dog, Sapo

I'm Pablo. Most of my newer repos are at Sourcehut, but a bunch remain here. You can get a better sense of who I am and how my brain works from my blog. Frontpage has a list of favorites, most are eng-related 😄

While I've done a ton of things for ~8 companies over ~12 years, most of my personal computing joy comes from programming languages and interpreters. I've done two Advent of Codes (2016, 2021) where I tried a different language every day and got to ~22.

scrabblecheat's People

Contributors

pablo-meier avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

Forkers

ewildgoose

scrabblecheat's Issues

Parallelization of AI code.

I wrote the move-searching algorithm in sequential Erlang for simplicity, but with a few tweaks (changing a few maps to pmaps, or replace a few foldl's that simply append results) could lead to dramatically improved performance on multicore machines, or distributed systems. Worth looking into, if only to use the strengths of the language ^_^

Move to OTP compliance

This project was written before I had much knowledge of Erlang and its conventions. We should consider a move to OTP compliance and standards, for example:

  • Better use of records for many of the datatypes I defined, rather than pattern matching (see get_tile_letter, get_followstruct_gadag, and the many, many other functions of that ilk. We could keep the API but change the internals to use Erlang records).
  • Directory structure and application resource file, among other things.

Many of the conventions are documented in the OTP Design and Principles Guide.

The client code is abysmal

Everything I hate and imagine as a messy, unmaintainable system is in the client code. I wrote it as a quick one-off, just wanting something quick and dirty to test my 'real' server code in. But it actually has a little potential as a client, and I ought to refactor the life out of it.

Among other things, it is wholly non-object-oriented (not taking advantage of Ruby...), and littered with conventions (most objects are just represented by hashes, and their definitions are in the serialization code). Most of the important work is in the Painter class, this should be broken up.

Hopefully the move to Thrift (#3) will ease this.

Figure out/create a real test harness

Currently I'm abusing EUnit's macros by calling each module individually as a separate call to the auto-generated test function. As we move to Thrift, this means INFO_REPORTS will pepper the test results. It might be worth looking into writing my own modules to call the tests and accumulate the results.

Types with Dialyzer

We should consider a move to refactor the code with proper user of Dialyzer, giving our code as much static verification as possible in Erlang.

Server doesn't reject bad moves.

If you sent a bad or invalid move to the server (e.g. disconnected words, words not in dictionary, etc.) the server doesn't reject them, it will just flatly score it.

Still creating incorrect moves.

Despite the fix for the last issue (#1), doing the same test case with a rack of SIGMA creates a word ZYGOTEAM. I suspect this is because AM is added to the "complete" pile before the applied fix is checked. I should really fix it the proper way, which is to make perpendicular checks look in all directions including the plane they are currently constructing on, and filter out any neighbor tiles that are part of your move.

Move to Thrift

The current way our server connect to any clients is through a homebrew string serialization scheme. While our data and communication model is simple now, any updates to it would be laborious and buggy. We should consider a move to Apache Thrift, which allows us to declare our datatypes in a high-level manner, and will automatically generate serialization code for the server and a larger number of clients.

Duplicate moves are returned.

When we return the top candidates for a move, oftentimes the top few moves are duplicates. Duplicates should be removed before returning them to the user.

Incorrect words being formed from Followstruct.

When the AI creates a move from a followstruct, oftentimes it creates an illegal move in one direction from a starting position. This is most notable during a parallel move, for example, if you have

     ABLE
ZYGO TE  

It may generate

     ABLE
ZYGO TES 
       A 
       N 
       D 

Which is legal for ZYGOTES, but not LSAND. This may be with initial letter placement, since a check_other_directions function already exists.

Auto-Generated Documentation

I've been documenting my code in a way very comfortable to me, but with no little other value. Following a former professor's Racket convention of type declarations in the comments, I should move to Dialyzer or another parseable/checkable format for types (see #4), but the prose might do well to move as well.

Investigate what tools in the vein of Javadoc, Pydoc, Doxygen exist for erlang, and maybe make it part of the build process.

Or I ROLL MY OWN WEB/TANGLE/WEAVE IN ERLANG!

Memory corruption in client when drawing moves on board.

The client demonstrates a form of memory corruption when selecting a move, and this only occurs when the client draws the moves onto the game board. The corruption manifests itself on the curses menu of moves that a user can select: when you move between them, their labels get replaced with gibberish.

If you remove the code that paints the selected move on the board, this is no longer an issue. This is how the code stand now, and moving between menu items erases the board from being drawn. It'd be nice to have the labels not corrupt, and draw the selected move on the board, as originally planned.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.