Post Reply 
8-Queens Benchmark
11-14-2021, 06:52 PM
Post: #33
RE: 8-Queens Benchmark
8-Queens with Python on PRIME.
G1 : 0.047
G2 : 0.022

I copied the MicroPython code from Xerxes' benchmark list. Added only the timing procedure of module hpprime, and deleted the loop
Code:
from hpprime import *
Time=eval("time")
a = [0] * 9
r = 8
s = 0
x = 0
y = 0
t = 0
while True:
 x += 1
 a[x] = r
 while True:
   s += 1
   y = x
   while y>1:
     y -= 1
     t = a[x]-a[y]
     if t==0 or x-y==abs(t):
       y=0
       a[x] -= 1
       while a[x]==0:
         x -= 1
         a[x] -= 1
   if y==1:
     break;
 if x==r:
   break;
Time=eval("time")-Time
print(s)
print(round(Time,6))
That is about 8 times faster than PPL on Prime: G2 ~0.166 times G1 ~0,38

G√ľnter
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
8-Queens Benchmark - Hlib - 05-23-2016, 06:08 PM
RE: 8-Queens Benchmark - xerxes - 05-24-2016, 02:28 PM
RE: 8-Queens Benchmark - Hlib - 05-27-2016, 08:14 PM
RE: 8-Queens Benchmark - Hlib - 06-25-2016, 06:39 PM
RE: 8-Queens Benchmark - xerxes - 06-26-2016, 06:47 PM
RE: 8-Queens Benchmark - mtern - 06-29-2016, 11:41 AM
RE: 8-Queens Benchmark - xerxes - 06-30-2016, 12:04 PM
RE: 8-Queens Benchmark - xerxes - 06-30-2016, 08:14 PM
RE: 8-Queens Benchmark - Accutron - 07-03-2016, 04:22 PM
RE: 8-Queens Benchmark - Accutron - 07-04-2016, 02:10 AM
RE: 8-Queens Benchmark - xerxes - 07-02-2016, 06:39 PM
RE: 8-Queens Benchmark - xerxes - 07-03-2016, 09:56 AM
RE: 8-Queens Benchmark - Accutron - 07-10-2016, 03:21 AM
RE: 8-Queens Benchmark - Egan Ford - 07-10-2016, 06:03 PM
RE: 8-Queens Benchmark - Accutron - 07-10-2016, 06:45 PM
RE: 8-Queens Benchmark - Accutron - 07-10-2016, 07:19 PM
RE: 8-Queens Benchmark - xerxes - 07-12-2016, 10:44 PM
RE: 8-Queens Benchmark - Accutron - 07-12-2016, 10:58 PM
RE: 8-Queens Benchmark - xerxes - 07-13-2016, 10:46 AM
RE: 8-Queens Benchmark - Accutron - 07-13-2016, 02:01 PM
RE: 8-Queens Benchmark - Jurgen Keller - 01-06-2017, 06:31 PM
RE: 8-Queens Benchmark - xerxes - 01-06-2017, 02:23 PM
RE: 8-Queens Benchmark - rprosperi - 01-06-2017, 04:00 PM
RE: 8-Queens Benchmark - xerxes - 01-07-2017, 06:56 PM
RE: 8-Queens Benchmark - Guenter Schink - 11-14-2021 06:52 PM
RE: 8-Queens Benchmark - xerxes - 11-15-2021, 11:37 PM



User(s) browsing this thread: 1 Guest(s)