This is a read-only snapshot of the ComputerCraft forums, taken in April 2020.
Dizzybabe99's profile picture

Problem with Chess Programm

Started by Dizzybabe99, 03 April 2013 - 11:54 AM
Dizzybabe99 #1
Posted 03 April 2013 - 01:54 PM
I wrote a quick chess Programm with notepad++, it is not finished jet but while testing the currend status, it dosent do my moves of the Figures.
I put the Program on pastbin ( http://pastebin.com/yqdRfTYV ).
Please take a look at the checkValid(), move() and slect() function.
I would be happy if you can give me a feedback why I heve this Problem and how the code is, but please remember it is not finished jet!
JokerRH #2
Posted 03 April 2013 - 02:21 PM
You watched DW20's lp, didn't you?
But anyway, your program has 785 lines, so I don't know if someone will look through all that code…:(/>
Could you maybe give a more detailed description of what your problem is or what might cause it?
(And by the way, you might want to ask leo.org about the meaning of afraid :D/> )
PixelToast #3
Posted 03 April 2013 - 03:39 PM
debug the slect function a bit

line 738:

if selectedX < 1 and selectedY < 1 then
why are you trying to check the impossible
mouse clicks cant go under 1,1 .-.
Dizzybabe99 #4
Posted 04 April 2013 - 02:22 AM
To PixelToast:
oh tath should be:
[indent=1]
[/indent]
[color=#AA9900][b]if[/b][/color][color=#000000] Figures[/color][color=#66CC66][[/color][color=#000000]d[/color][color=#66CC66]][/color][color=#66CC66][[/color][color=#000000]c[/color][color=#66CC66]][/color][color=#66CC66][[/color][color=#CC66CC]2[/color][color=#66CC66]][/color][color=#000000] [/color][color=#66CC66]==[/color][color=#000000] [/color][color=#CC66CC]16[/color][color=#000000] [/color][color=#AA9900][b]then[/b][/color]
[color=#AA9900][b]if[/b][/color][color=#000000] selectedX [/color][color=#66CC66]<[/color][color=#000000] [/color][color=#CC66CC]1[/color][color=#000000] [/color][color=#AA9900][b]and[/b][/color][color=#000000] selectedY [/color][color=#66CC66]<[/color][color=#000000] [/color][color=#CC66CC]1[/color][color=#000000] [/color][color=#AA9900][b]then[/b][/color]
[color=#000000]continue [/color][color=#66CC66]=[/color][color=#000000] continue[/color][color=#66CC66]+[/color][color=#CC66CC]1[/color]
[color=#AA9900][b]end[/b][/color]
[color=#000000]selectedX [/color][color=#66CC66]=[/color][color=#000000] c[/color]
[color=#000000]selectedY [/color][color=#66CC66]=[/color][color=#000000] d[/color]


and not:
[color=#AA9900][b]if[/b][/color][color=#000000] Figures[/color][color=#66CC66][[/color][color=#000000]d[/color][color=#66CC66]][/color][color=#66CC66][[/color][color=#000000]c[/color][color=#66CC66]][/color][color=#66CC66][[/color][color=#CC66CC]2[/color][color=#66CC66]][/color][color=#000000] [/color][color=#66CC66]==[/color][color=#000000] [/color][color=#CC66CC]16[/color][color=#000000] [/color][color=#AA9900][b]then[/b][/color]
[color=#000000]selectedX [/color][color=#66CC66]=[/color][color=#000000] c[/color]
[color=#000000]selectedY [/color][color=#66CC66]=[/color][color=#000000] d[/color]
[color=#000000] [/color][color=#AA9900][b]if[/b][/color][color=#000000] selectedX [/color][color=#66CC66]<[/color][color=#000000] [/color][color=#CC66CC]1[/color][color=#000000] [/color][color=#AA9900][b]and[/b][/color][color=#000000] selectedY [/color][color=#66CC66]<[/color][color=#000000] [/color][color=#CC66CC]1[/color][color=#000000] [/color][color=#AA9900][b]then[/b][/color]
[color=#000000]continue [/color][color=#66CC66]=[/color][color=#000000] continue[/color][color=#66CC66]+[/color][color=#CC66CC]1[/color]
[b]end[/b]


[indent=1]Thanks that was my problem. So it was Stuck in the loop and dont get to the check if the move is valid.[/indent]
[indent=1]It was to check that it didn't add and add 1 to the continue variable.[/indent]

To JokerRH:
[indent=1]Yes I got the idea from direwolf20, but I dont understand what was so hard on a chess programm (whithout the changing from a "Farmer" (sorry I dont know what it is called in Englich for the chess game) to any other figure.[/indent]