Cómo determino el jaque y/o jaque mate?


tengo este código (lenguaje python 3):

def printBoard(b):

for row in b:     for col in row:         print(col, end=" ")     print() 

def findPiece(b, p):

for row in range(len(b)):     for col in range(len(b[row])):         if b[row][col] == p:             return [row, col] return [-1, 1] 

board = [

[‘@’, ‘K’, ‘@’, ‘#’, ‘@’, ‘#’, ‘@’, ‘#’],

[‘#’, ‘@’, ‘#’, ‘@’, ‘#’, ‘@’, ‘#’, ‘@’],

[‘@’, ‘#’, ‘Q’, ‘#’, ‘@’, ‘#’, ‘@’, ‘#’],

[‘#’, ‘@’, ‘#’, ‘@’, ‘#’, ‘@’, ‘#’, ‘@’],

[‘@’, ‘#’, ‘@’, ‘#’, ‘@’, ‘#’, ‘@’, ‘#’],

[‘#’, ‘@’, ‘#’, ‘@’, ‘#’, ‘@’, ‘#’, ‘@’],

[‘@’, ‘#’, ‘@’, ‘#’, ‘@’, ‘#’, ‘@’, ‘#’],

[‘#’, ‘@’, ‘#’, ‘@’, ‘#’, ‘@’, ‘#’, ‘k’]

] 

printBoard(board)

whiteKing = findPiece(board, ‘K’)

print( “White king at:”, whiteKing)

whiteQueen = findPiece(board, ‘Q’)

print( “White Queen at:”, whiteQueen)

blackKing = findPiece(board, ‘k’)

print( “Black king at:”, blackKing)

Se que el resultado es que sí lo pone en jaque pero no jaque mate y por ello tiene que imprimir Check = Yes Checkmate = No, lo que falta es el proceso para comprobarlo, para ello tengo que determinar los movimientos de la reina blanca. Agradezco mucho su tiempo

Ubuntu Mate (rendering) terribly slow on Ubuntu 18.04

I’m running Ubuntu Mate 18.04.3 on a MacBook Pro (Retina) from Mid 2014, but the speed on which some applications run makes it impossible to work with. Especially chrome, chromium, firefox, slack (uses chromium), there’s a lot of lag when typing or scrolling and it takes a very long time to load a website that uses a lot of javascript for visualizations, like a dashboard.

Booting up and running shell and other programs is quick as at should be and the other os, OSX, runs just fine.

I’d tried changing the hardware acceleration in chrome and firefox and installed mbpfan but nothing changed.

Any help would be greatly appreciated, I’d have to move back to use OSX as my default OS if there’s no way to fix this. And that’s something I’d like to avoid.

Below is more info on my system and some relevant output from several commands. I ran htop as well, and surely cpu usage did increase when running one of the applications, but it did not use a abnormal amount of cpu / ram.

Ubuntu is installed on the internal SSD.

Specifications of machine

inxi -SMIG -! 31

System:    Kernel: 5.0.0-31-generic x86_64 bits: 64 Desktop: MATE 1.20.1  Distro: Ubuntu 18.04.3 LTS Machine:   Device: laptop System: Apple product: MacBookPro11 2 v: 1.0 serial: N/A            Mobo: Apple model: Mac-3CBD00234E554E41 v: MacBookPro11 2 serial: N/A            UEFI: Apple v: MBP112.88Z.0146.B00.1804111138 date: 04/11/2018 Graphics:  Card: Intel Crystal Well Integrated Graphics Controller            Display Server: x11 (X.Org 1.20.4 ) drivers: modesetting (unloaded: fbdev,vesa)            Resolution: 2880x1800@59.99hz, 2560x1440@59.95hz            OpenGL: renderer: Mesa DRI Intel Haswell Mobile version: 4.5 Mesa 19.0.8 Info:      Processes: 261 Uptime: 37 min Memory: 1660.9/15946.0MB Client: Shell (zsh) inxi: 2.3.56 

cat /etc/os-release

NAME="Ubuntu" VERSION="18.04.3 LTS (Bionic Beaver)" ID=ubuntu ID_LIKE=debian PRETTY_NAME="Ubuntu 18.04.3 LTS" VERSION_ID="18.04" 

cat /proc/version

 Linux version 5.0.0-31-generic (buildd@lgw01-amd64-046) (gcc version 7.4.0 (Ubuntu 7.4.0-1ubuntu1~18.04.1)) #33~18.04.1-Ubuntu SMP Tue Oct 1 10:20:39 UTC 2019 

glxinfo | grep render

direct rendering: Yes     GLX_MESA_multithread_makecurrent, GLX_MESA_query_renderer,      GLX_INTEL_swap_event, GLX_MESA_copy_sub_buffer, GLX_MESA_query_renderer,  Extended renderer info (GLX_MESA_query_renderer): OpenGL renderer string: Mesa DRI Intel(R) Haswell Mobile      GL_ARB_compute_shader, GL_ARB_conditional_render_inverted,      GL_MESA_texture_signed_rgba, GL_NV_conditional_render, GL_NV_depth_clamp,      GL_ARB_compute_shader, GL_ARB_conditional_render_inverted,      GL_NV_conditional_render, GL_NV_depth_clamp, GL_NV_fog_distance,      GL_EXT_render_snorm, GL_EXT_robustness, GL_EXT_sRGB_write_control,      GL_OES_fbo_render_mipmap, GL_OES_geometry_point_size, 

cpufreq-info copied for 1 core

cpufrequtils 008: cpufreq-info (C) Dominik Brodowski 2004-2009 Report errors and bugs to cpufreq@vger.kernel.org, please. analyzing CPU 0:   driver: intel_pstate   CPUs which run at the same hardware frequency: 0   CPUs which need to have their frequency coordinated by software: 0   maximum transition latency: 4294.55 ms.   hardware limits: 800 MHz - 3.40 GHz   available cpufreq governors: performance, powersave   current policy: frequency should be within 800 MHz and 3.40 GHz.                   The governor "powersave" may decide which speed to use                   within this range.   current CPU frequency is 3.27 GHz. 

cat /sys/class/thermal/thermal_zone*/temp

30900 76000 

cat /proc/cpuinfo copied for 1 core

processor   : 0 vendor_id   : GenuineIntel cpu family  : 6 model       : 70 model name  : Intel(R) Core(TM) i7-4770HQ CPU @ 2.20GHz stepping    : 1 microcode   : 0x1b cpu MHz     : 3236.768 cache size  : 6144 KB physical id : 0 siblings    : 8 core id     : 0 cpu cores   : 4 apicid      : 0 initial apicid  : 0 fpu     : yes fpu_exception   : yes cpuid level : 13 wp      : yes flags       : {REMOVED} bugs        : cpu_meltdown spectre_v1 spectre_v2 spec_store_bypass l1tf mds swapgs bogomips    : 4389.96 clflush size    : 64 cache_alignment : 64 address sizes   : 39 bits physical, 48 bits virtual power management: 

How to get a new mail alert notification popup for Postfix localhost mail in Ubuntu MATE 19.04

I have configured Postfix along with Mailutils to send and receive mails from localhost in Ubuntu MATE 19.04. I can read mails through terminal just fine.

Now how do I get new mail alert notification popups in system tray for incoming mails? Like upon a system boot and whenever new mail arrives afterwards. I’d like the notifications to stay there until dismissed. Many thanks.

Note: Just to be extra clear this setup is for “local only” mails.

Postfix version: 3.3.2-4 Mailutils version: 1:3.5-2build1 

How to get a new mail alert notification popup for Postfix localhost mail in Ubuntu MATE 19.04

I have configured Postfix along with Mailutils to send and receive mails from localhost in Ubuntu MATE 19.04. I can read mails through terminal just fine.

Now how do I get new mail alert notification popups in system tray for incoming mails? Like upon a system boot and whenever new mail arrives afterwards. I’d like the notifications to stay there until dismissed. Many thanks.

Note: Just to be extra clear this setup is for “local only” mails.

Postfix version: 3.3.2-4 Mailutils version: 1:3.5-2build1 

Retrieve background color in ubuntu mate

I am using Ubuntu mate 18.04.3 LTS.

I am quite fond of my background color and would like to use it on another machine. Where can I find the exact color that is used? When I go into the Control center and get the Appearance Preferences window, and then the Background tab, I see my color, but when I click on my background color next to Color: Solid color, I get a color selector that is positioned on a red color, while I want a blue color, so that is not the current one.

XRDP not running Gcompris. Mate desktop

XRDP works fine for other applications. Gcompris opens fine locally.

I tried using vino as an alternative and that’s mostly okay. I need audio for gcompris and other applications to really be useful. To my knowledge I can’t do that with vino. Also, since vino lets the client take over the active desktop I can’t have concurrent users like xrdp will allow. It’s not ideal to need more than one VM for this, but that would be fine if it makes things easier.

My end goal is to have a single VM running applications from the edubuntu bundle. I need a way to have more than one client log in remotely and have audio. It’s all happening on my home network so security is not an issue. I’m using fire tablets as the clients. I can also use Nook tablets. It would be okay to just connect to a single application at a time, but I’m not sure if I would want that just yet. I saw where there are various ways to redirect audio if you are using VNC, but I don’t necessarily want to head down that path if it’s just something simple with XRDP and the gcompris application that can be resolved.

Given one sending stone, how can I locate its mate?

Suppose I have one of a pair of sending stones, and I wish to locate the other stone of the pair. Is there any spell or other magic that will allow me to find the stone’s mate? Assume I have never held or seen the stone’s mate.

A limited range solution is potentially acceptable, but longer range or unlimited range solution is preferred (even more so if it works across planes), since I have no way of knowing where the other stone is. However, any solution must locate the specific stone, not just any sending stone (not least because unless I have a bag of holding, the nearest sending stone is always going to be the one in my pocket). If there are any additional limitations to the solution, be sure to note them (e.g. “the stone must not be in the possession of a creature”, “the stone must not be inside a lead box”, etc.). Lastly, casting Wish and wishing to know the stone’s location should obviously work, so there’s no need to mention this option (also, casting Wish in this way carries the very severe limitations of needing a 9th level spell and risking losing access to Wish, so I wouldn’t consider it a great solution). In short: the best solution would have the longest possible range and the fewest possible limitations.

Apt-Cache Corruption problem on Linux Mint Tessa Mate 19.1 [on hold]

I cannot seem to solve an issue with a apt-cache corruption problem on my operating system. Now I have looked up the issues and tried a few commands, but its not seeming to work. So I need guidance on issue see anyone else has ran into this problem and found a solution to fix…. I have also tried basics of switching the mirrors and still run into the issue as well….. maybe a clean install or upgrade to the next version is my second option if I cant find a solution.

Eclipse on Ubuntu Mate

I’ve just installed Eclipse IDE for Java Developers on Ubuntu Mate. The console is giving me fatal errors:

(WebKitWebProcess:19041): GLib-CRITICAL **: 17:07:33.039: g_variant_get_type: assertion 'value != NULL' failed  (WebKitWebProcess:19041): GLib-CRITICAL **: 17:07:33.039: g_variant_type_is_subtype_of: assertion 'g_variant_type_check (type)' failed  (WebKitWebProcess:19041): GLib-CRITICAL **: 17:07:33.039: g_variant_get_int32: assertion 'g_variant_is_of_type (value, G_VARIANT_TYPE_INT32)' failed ** ERROR:webkitgtk_extension.c:47:proxy_init: assertion failed: (parentUniqueId != 0)  (Eclipse:18968): Gtk-CRITICAL **: 17:08:34.496: gtk_box_gadget_distribute: assertion 'size >= 0' failed in GtkScrollbar 

Is there a trick to get eclipse running on Ubuntu-Mate?

Ubuntu-Mate 18.03.3 LTS (Bionic) 32-bit

Eclipse IDE for Java Developers

Version: 2018-09 (4.9.0), Build id: 20180917-1800