uint8 DreamWebEngine::getBlockOfPixel(uint8 x, uint8 y) { uint8 flag, flagEx, type, flagX, flagY; checkOne(x + _mapXStart, y + _mapYStart, &flag, &flagEx, &type, &flagX, &flagY); if (flag & 1) return 0; else return type; }
int main() { freopen("D.in", "r", stdin); freopen("D.out", "w", stdout); while (true) { scanf("%d", &n); if (n == 0) break; memset(map, -1, sizeof map); int nBlack = 0, nWhite = 0; for (int i = 0; i < n; i++) { int x, y, c; scanf("%d%d%d", &x, &y, &c); map[x][y] = c; if (c == 0) nWhite++; else nBlack++; } std::vector<std::pair<int, int> > free; for (int i = 0; i < 15; i++) for (int j = 0; j < 15; j++) if (map[i][j] == -1) { free.push_back(std::make_pair(i, j)); } int firstMove; if (nBlack == nWhite) { firstMove = 1; } else if (nBlack == nWhite + 1) { firstMove = 0; } else { puts("Invalid."); continue; } std::pair<bool, std::pair<int, int> > ret; ret = checkOne(free, firstMove); if (ret.first) { printf("Place %s at (%d,%d) to win in 1 move.\n", NAME[firstMove], ret.second.first, ret.second.second); continue; } if (checkTwo(free, firstMove)) { printf("Lose in 2 moves.\n"); continue; } ret = checkThree(free, firstMove); if (ret.first) { printf("Place %s at (%d,%d) to win in 3 moves.\n", NAME[firstMove], ret.second.first, ret.second.second); continue; } puts("Cannot win in 3 moves."); } return 0; }
bool SelectorChecker::match(const CSSSelector& selector) { const CSSSelector* current = &selector; do { if (!checkOne(*current)) return false; current = current->tagHistory(); } while (current); return true; }
void DreamWebEngine::dropObject() { if (_commandType != 223) { _commandType = 223; if (!_pickUp) { blank(); return; } commandWithOb(37, _objectType, _itemFrame); } if (_mouseButton == _oldButton || !(_mouseButton & 1)) return; if (isItWorn(getEitherAd())) { wornError(); return; } if (_realLocation != 47) { byte flag, flagEx, type, flagX, flagY; checkOne(_ryanX + 12, _ryanY + 12, &flag, &flagEx, &type, &flagX, &flagY); if (flag >= 2) { dropError(); return; } } else { dropError(); return; } if (_mapXSize == 64 && _mapYSize == 64) { // Inside lift dropError(); return; } if (compare(_itemFrame, kExObjectType, "GUNA") || compare(_itemFrame, kExObjectType, "SHLD")) { cantDrop(); return; } _objectType = kExObjectType; DynObject *object = getExAd(_itemFrame); object->mapad[0] = 0; object->mapad[1] = ((_ryanX + 4) >> 4) + _mapX; object->mapad[2] = (_ryanX + 4) & 0xF; object->mapad[3] = ((_ryanY + 8) >> 4) + _mapY; object->mapad[4] = (_ryanY + 8) & 0xF; _pickUp = 0; object->currentLocation = _realLocation; }
void DreamWebEngine::identifyOb() { if (_vars._watchingTime != 0) { blank(); return; } uint16 initialX = _mouseX - _mapAdX; uint16 initialY = _mouseY - _mapAdY; if (initialX >= 22 * 8 || initialY >= 20 * 8) { blank(); return; } byte x = initialX & 0xFF; byte y = initialY & 0xFF; _inMapArea = 1; _pointersPath = findPathOfPoint(x, y); _pointerFirstPath = findFirstPath(x, y); if (checkIfEx(x, y) || checkIfFree(x, y) || checkIfPerson(x, y) || checkIfSet(x, y)) return; // finishidentify x = (_mouseX - _mapAdX) & 0xFF; y = (_mouseY - _mapAdY) & 0xFF; byte flag, flagEx, type, flagX, flagY; checkOne(x, y, &flag, &flagEx, &type, &flagX, &flagY); if (type != 0 && _vars._manDead != 1) obName(type, 3); else blank(); }
bool SelectorChecker::match(const SelectorCheckingContext& context) const { // FIXME(sky): Get rid of SelectorCheckingContext. SelectorCheckingContext matchContext(context); bool isShadowHost = isHostInItsShadowTree(*context.element, context.scope) && !(context.contextFlags & TreatShadowHostAsNormalScope); while (true) { const CSSSelector& selector = *matchContext.selector; // Only :host and :host-context() should match the host: // http://drafts.csswg.org/css-scoping/#host-element if (isShadowHost && !selector.isHostPseudoClass()) return false; if (!checkOne(matchContext)) return false; if (selector.isLastInTagHistory()) return scopeContainsLastMatchedElement(matchContext); matchContext.selector = selector.tagHistory(); } ASSERT_NOT_REACHED(); return false; }