public inbox for cygwin@cygwin.com
 help / color / mirror / Atom feed
From: Daniel Hartmeier <daniel@benzedrine.ch>
To: SY Tang <swenyitang99@gmail.com>
Cc: cygwin@cygwin.com
Subject: Re: Hexiom Solver Error: Anchor Not Found
Date: Wed, 04 Apr 2018 20:45:00 -0000	[thread overview]
Message-ID: <20180404204500.GA91500@insomnia.benzedrine.ch> (raw)
In-Reply-To: <CAB28kD--XvBOg0n8Zm2YnpQWytY8=BJD4wwFjjGEorDYU6rqGw@mail.gmail.com>

On Wed, Apr 04, 2018 at 06:48:07PM +0800, SY Tang wrote:

> However, try as I might, I am unable to get it to work, I first got an
> error which says: *"WARNING: Couldn't compute FAST_CWD pointer"*, which I
> believe i self-fixed by running in Windows XP compatibility mode. After
> which, I still get another error which says *"Anchor not found"* and then a
> layout of 0s appear.
> 
> I assume that the "anchor" is the hexiom board which the program is
> supposed detect, but I do not understand how it cannot detect the board: I
> resized my chrome browser window so that the hexiom board takes the entire
> left half of the screen, with the cmd prompt on the right half, yet the
> program still shows the error. I watched the demonstration video and I
> can't find what I'm doing wrong. Can you please assist?
> 
> For your info, I am running Windows 10, Chrome Browser for the Hexiom game.

The program is taking a screenshot and searching the bitmap for the
upper left corner of the hexagon board, see function scan() in scrape.c

        for (py = 0; py < h - 1; ++py) {
                for (px = 0; px < w - 1; ++px) {
                        if (diff(R(px,     py), 0x25020C) < 4 &&
                            diff(R(px + 1, py), 0x25020C) < 4 &&
                            diff(R(px, py + 1), 0x25020C) < 4 &&
                            diff(R(px + 1, py + 1), 0x7F7F7F) < 4) {
                                fx = px;
                                fy = py;
                        }
                }
        }
        if (fx < 0 || fy < 0) {
                printf("anchor not found!\n");
                free(p);
                return;
        }

It looks for a two-by-two pixel square where the bottom-right pixel has
RGB color 127,127,127 (grey) and the other three pixels have RGB color
37,2,12 (redish almost black).

You could try to take a screenshot, write it into a bitmap file, open
that with MSPaint and check the RGB colors of the pixels at the upper
left corner of the hexagon.

This still works for me on Mac with Safari, if I find time I can give it
another try on a more recent Windows with an up-to-date cygwin.

I guess you could also just move the browser window so the corner is at
a known position, and edit scrape.c to simply set fx and fy to those
coordinates and rebuild a binary.

HTH,
Daniel

--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple

      parent reply	other threads:[~2018-04-04 20:45 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-04-04 10:48 SY Tang
2018-04-04 16:20 ` David Stacey
2018-04-04 20:45 ` Daniel Hartmeier [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180404204500.GA91500@insomnia.benzedrine.ch \
    --to=daniel@benzedrine.ch \
    --cc=cygwin@cygwin.com \
    --cc=swenyitang99@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).