Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

The 20 Line Challenge / Chess in 20 lines!

Author
Message
Pasky
14
Years of Service
User Offline
Joined: 7th Jun 2005
Location: Spain
Posted: 28th Apr 2008 12:07 Edited at: 28th Apr 2008 13:28
Hello.

Doing anything in just 20 lines is already in itself a challenge.
But if the intention is to make something as complex as a game of chess mission moves from difficult to nearly impossible.
And unfortunately for me, that sort of thing I like light attracts moths.

He made two codes.
They are identical except that one creates its own "media" and the other needs of the images that I have put into the download.
Anyone who creates their own images is a 20+6 lines.
I am afraid I have not been able to put in all 20 lines.
The second code if it is 20 lines, but needs images.

It has not been easy to codify the rules of the game of chess, making the party so that the human player moves and above all, make a rudimentary AI to play the computer.
Already warning that anyone expect something as simple and basic as having a level playing like Kasparov.
Rather plays as they would a child.
But until that is something tremendamnte compound.
Anyone who has ever tried to make a chess comprising what I mean.

Code 1:


Code 2:



I hope you like.
A greeting.

Attachments

Login to view attachments
Jeff032
11
Years of Service
User Offline
Joined: 13th Aug 2007
Location:
Posted: 28th Apr 2008 13:02
Pretty good, but sometimes the other player didn't move and it went back to my turn. Eventually its king just sat in check while it moved other pieces around.

Perhaps I'll give it a try later.

Pasky
14
Years of Service
User Offline
Joined: 7th Jun 2005
Location: Spain
Posted: 28th Apr 2008 13:31 Edited at: 28th Apr 2008 13:32
Not why they have put some "\" where there were quotes.

We put everything in the download.
The codes and images.
So not be more problems.

These programs are for 1,066 DBP and Windosws XP.

They should not make any mistake.

Attachments

Login to view attachments
Jeff032
11
Years of Service
User Offline
Joined: 13th Aug 2007
Location:
Posted: 28th Apr 2008 17:54 Edited at: 28th Apr 2008 17:58
I removed the '\' where there were quotes when I tried it. And also, this time, there are times when it prevents me from making certain legal moves. I'm not in check or anything.

If you can figure out the bug, you should think about adding castling and en passant (and knights)

[EDIT]
Played another game, the computer player didn't move after my first move or my third move.

BMacZero
13
Years of Service
User Offline
Joined: 30th Dec 2005
Location: E:/ N_America/ USA/ CA/ South
Posted: 29th Apr 2008 02:47
Worked great for me, it seemed obsessed with knights, though. Pasky, once again you are a 20-line genius!

Unterseeboot - Has you played it?
Los Mineros are on leave...
Pasky
14
Years of Service
User Offline
Joined: 7th Jun 2005
Location: Spain
Posted: 29th Apr 2008 14:04
Thank you.

We have to persecution mania horse because I have given more value to that piece that the bishop or the tower.

Humans know how to handle the horse better than him, so I will try to eliminate that threat.

Instead of an AI it has turned into an AS (Artificial Stupid) ... hehehe
draknir_
12
Years of Service
User Offline
Joined: 19th Oct 2006
Location: Netherlands
Posted: 29th Apr 2008 19:37
wow im really impressed, great work! any chance you could expand the code so its readable?
theplake
11
Years of Service
User Offline
Joined: 30th Nov 2007
Location:
Posted: 1st May 2008 14:25
Hi
I want translate this code in darkgdk. but i dont know how translate this: f(2,58,25,58,1)

anyone a help for me?
Pasky
14
Years of Service
User Offline
Joined: 7th Jun 2005
Location: Spain
Posted: 2nd May 2008 00:44
draknir_:

I can not promise to do so, but attempts to put the uncompressed code.
But you notice that this still very difficult to understand for the manner in which he had to schedule saving up to the last byte.

theplake:
That is a function, the only one that exists in the program because the compiler does not support more than one when compressed code and the function name is on the same line as the body of the function.
It is a function that performs several tasks, which have nothing to do with one another.
Normally it would have been to create a role for each of them but the demands of a 20 lines force me to do so.
When I unzip the program for draknir_ will be better.
Tone Dialer
Valued Member
13
Years of Service
User Offline
Joined: 17th Oct 2005
Location: England, well a town in it !
Posted: 13th Jun 2008 09:25
Pasky:

I tried the game for the first time today and thought it was really good.

onkypokey
13
Years of Service
User Offline
Joined: 19th Dec 2005
Location:
Posted: 15th Jul 2008 12:07
incredible...!
Libervurto
13
Years of Service
User Offline
Joined: 30th Jun 2006
Location: On Toast
Posted: 18th Jul 2008 01:21
Could you post an uncompressed version please pasky

It is far better to complete a 10 line program than to start a 10,000 line program.
DarkBasic Pro Guy
15
Years of Service
User Offline
Joined: 4th Jun 2004
Location: Broomfield, Colorado
Posted: 26th Aug 2008 21:43
I must say I'm impressed with the first code, even if it is 26 lines it is still pretty good (especially the pieces, those are ace)

The second code also looks great, but I was more impressed with the first.
Ambitious Guy
10
Years of Service
User Offline
Joined: 1st Aug 2008
Location: Florida, USA
Posted: 3rd Nov 2008 18:31
I'm very impressed. I'm a big fan of Chess. The AI is very well done.
C0wbox
13
Years of Service
User Offline
Joined: 6th Jun 2006
Location: 0,50,-150
Posted: 3rd Nov 2008 21:06 Edited at: 3rd Nov 2008 21:09
Pretty cool game. The computer saw through my moves everytime.

(I also originally thought this was wrongly accused checkmate until I saw the bishop on the left.)

Attachments

Login to view attachments
Neodelito
13
Years of Service
User Offline
Joined: 29th Jul 2005
Location:
Posted: 9th Dec 2008 22:09
Haaa! your code break my brain...

how i can see the basic mov like pe2e4
or inject movs in console mode

plis...
nice code


For Download All my models go to http://jaimezegpi.webcindario.com jaimezegpi@yahoo.es
Pasky
14
Years of Service
User Offline
Joined: 7th Jun 2005
Location: Spain
Posted: 23rd Dec 2008 10:25
Sorry, but I fear that my days as a programmer has finished.
At least for now.
(I could never be too long doing the same thing.)
I visit the forums, this and another, not to stay off, but little more.
But thank you for your comments about the 20 lines.
I will come back ...
Francis
10
Years of Service
User Offline
Joined: 24th Nov 2008
Location: London, England.
Posted: 31st Dec 2008 20:11
Amazing dude, great work, I got beaten xD.
Not_Maindric
12
Years of Service
User Offline
Joined: 10th Jul 2007
Location: Omaha, NE
Posted: 8th Jan 2009 22:40
Wow Pasky, you are done? I looked at some of your works, and you are pretty good!

As for this, I played it an was surprised. As expected, I never won. ;D

awsumman4
10
Years of Service
User Offline
Joined: 4th Jan 2009
Location: PWNAGE GAMES HQ
Posted: 17th Jan 2009 07:22
1337 coding man

PWNAGE GAMES (working on the logo)
Serge Adjo
12
Years of Service
User Offline
Joined: 3rd Aug 2006
Location:
Posted: 15th Feb 2009 17:00 Edited at: 15th Feb 2009 17:00
hi there, I've tested it, played, enjoyed. yep quite good. notice a bug: when I change the window for another and then go back to the program: all the media disapear and I only see the chessboard , all empty ; so can you fix this ?

pascontent.
Diggsey
13
Years of Service
User Offline
Joined: 24th Apr 2006
Location: On this web page.
Posted: 7th Mar 2009 23:51
This code is actually amazing!

@Serge Adjo
That is because you have set it to fullscreen exclusive mode...

[b]Yuor signutare was aresed by a deslyxic mud...
BOX2D V2 HAS HELP FILES! AND A WIKI!
zaxer thawl
11
Years of Service
User Offline
Joined: 29th Jan 2008
Location: Fredericksburg Texas
Posted: 11th Apr 2009 20:06
nice work

Coreldraw Graphics suite X3 >>>>> Yes
Darkbasic pro >>>>> Yes
DB newbie
13
Years of Service
User Offline
Joined: 13th Nov 2005
Location: um..... i dont remember.
Posted: 12th Apr 2009 02:35 Edited at: 12th Apr 2009 02:35
really good.

is it possible that you can also post a non condensed version if you have it?


Come see the WIP!

cguy
11
Years of Service
User Offline
Joined: 3rd Nov 2007
Location: In my Computer!
Posted: 12th Apr 2009 08:01 Edited at: 12th Apr 2009 08:17
I beat it! No just kidding, I wasn't even close
I was so cool though, I'm going to give you some fruit and coffee

EDIT: Awsome! I beat it on the second try. A very dificult game for such a short code.

Do we all have to put stupid jokes here?

Attachments

Login to view attachments
Lost in Thought
15
Years of Service
User Offline
Joined: 4th Feb 2004
Location: U.S.A. : Douglas, Georgia
Posted: 12th Apr 2009 09:37 Edited at: 12th Apr 2009 19:01
Wow that is pretty good for 20 lines. A few things if you wanna make a full version of maybe even fix that one. The bottom right corner is supposed to be white always. There's no castling. It misses simple attacks sometimes. Pretty good though with the line limitation.

[edit] Also it lets you make moves that puts your king in check. And the stalemate code for the light colored pieces seems to be busted. I can stalemate him, but if I get stalemated it doesn't. I just have to move and then let him kill me.

Potassium
10
Years of Service
User Offline
Joined: 12th Jul 2009
Location:
Posted: 22nd Jul 2009 20:45
I owned the computer with the 4 move checkmate

But good job, with 20 lines, i would expect chess to take hundreds or thousands of lines of code.
zeroSlave
10
Years of Service
User Offline
Joined: 13th Jun 2009
Location: Springfield
Posted: 22nd Jul 2009 21:55
@ potassium... Me too! See image...

Attachments

Login to view attachments
Potassium
10
Years of Service
User Offline
Joined: 12th Jul 2009
Location:
Posted: 23rd Jul 2009 22:12
Most chess AI block the 4-move checkmate.

But I tried it and the computer was completely unaware. The computer never beat me though.

The computer is trained for basic moves not for extreme playing. That's why its the 20-line challenge, not the 1000 line challenge.

Login to post a reply

Server time is: 2019-07-17 05:33:48
Your offset time is: 2019-07-17 05:33:48