All about flooble | fun stuff | Get a free chatterbox | Free JavaScript | Avatars    
perplexus dot info

Home > Games
King to F1 (Posted on 2008-07-23) Difficulty: 2 of 5
If the Black knight (at h4) must stay immobile and cannot be captured, how can you get the White king (at h2) to the empty f1 square by making consecutive White moves within the portion of the board shown? At any time, the White King may not move into check.

See The Solution Submitted by pcbouhid    
No Rating

Comments: ( Back to comment list | You must be logged in to post comments.)
Solution cheating computer solution | Comment 3 of 7 |
(In reply to Solution by Dej Mar)

:bf1:qg2:kh3:bh2:rg1:qh1:bg2:rf1:bg1:kh2:bh3:qg2:kh1:bh2:rg1:qf1:rg2:bg1:rh2:bg2:rh3:bh2:kg1:bh1:qg2:kf1

found by

Dim b$(8, 8), emptyX, emptyY, lvl, h$
Private Sub Start_Click()

emptyX = 6: emptyY = 1

b$(7, 1) = "b": b$(7, 2) = "b"
b$(8, 1) = "r": b$(8, 2) = "k": b$(8, 3) = "q"

moveIt

Print "end"
End Sub
Sub moveIt()
 DoEvents
 lvl = lvl + 1
 If lvl = 15 Then Text1.Text = h$
 If b$(6, 1) = "k" Then
   Text2.Text = Text2.Text & h$ & Chr$(13) & Chr$(10): Exit Sub
 End If

 If lvl > 27 Then lvl = lvl - 1: Exit Sub

  
 Select Case 10 * emptyX + emptyY
   Case 61
    If b$(7, 2) = "b" Or b$(7, 2) = "q" Then sendX = 7: sendY = 2: GoSub tryIt
    If b$(7, 1) = "r" Or b$(7, 1) = "q" Or b$(7, 1) = "k" Then sendX = 7: sendY = 1: GoSub tryIt
   Case 71
    If b$(6, 1) = "r" Or b$(6, 1) = "q" Then sendX = 6: sendY = 1: GoSub tryIt
    If b$(7, 2) = "r" Or b$(7, 2) = "q" Then sendX = 7: sendY = 2: GoSub tryIt
    If b$(8, 1) = "r" Or b$(8, 1) = "q" Or b$(8, 1) = "k" Then sendX = 8: sendY = 1: GoSub tryIt
    If b$(8, 2) = "b" Or b$(8, 2) = "q" Or b$(8, 2) = "k" Then sendX = 8: sendY = 2: GoSub tryIt
   Case 72
    If b$(7, 1) = "r" Or b$(7, 1) = "q" Then sendX = 7: sendY = 1: GoSub tryIt
    If b$(6, 1) = "b" Or b$(6, 1) = "q" Then sendX = 6: sendY = 1: GoSub tryIt
    If b$(8, 1) = "b" Or b$(8, 1) = "q" Then sendX = 8: sendY = 1: GoSub tryIt
    If b$(8, 3) = "b" Or b$(8, 3) = "q" Then sendX = 8: sendY = 3: GoSub tryIt
    If b$(8, 2) = "r" Or b$(8, 2) = "q" Then sendX = 8: sendY = 2: GoSub tryIt
   Case 81
    If b$(8, 2) = "r" Or b$(8, 2) = "q" Or b$(8, 2) = "k" Then sendX = 8: sendY = 2: GoSub tryIt
    If b$(7, 1) = "r" Or b$(7, 1) = "q" Or b$(7, 1) = "k" Then sendX = 7: sendY = 1: GoSub tryIt
    If b$(7, 2) = "b" Or b$(7, 2) = "q" Then sendX = 7: sendY = 2: GoSub tryIt
   Case 82
    If b$(8, 1) = "r" Or b$(8, 1) = "q" Or b$(8, 1) = "k" Then sendX = 8: sendY = 1: GoSub tryIt
    If b$(8, 3) = "r" Or b$(8, 3) = "q" Or b$(8, 3) = "k" Then sendX = 8: sendY = 3: GoSub tryIt
    If b$(7, 2) = "r" Or b$(7, 2) = "q" Then sendX = 7: sendY = 2: GoSub tryIt
    If b$(7, 1) = "b" Or b$(7, 1) = "q" Or b$(7, 1) = "k" Then sendX = 7: sendY = 1: GoSub tryIt
   Case 83
    If b$(8, 2) = "r" Or b$(8, 2) = "q" Or b$(8, 2) = "k" Then sendX = 8: sendY = 2: GoSub tryIt
    If b$(7, 2) = "b" Or b$(7, 2) = "q" Then sendX = 7: sendY = 2: GoSub tryIt
 End Select
 lvl = lvl - 1
Exit Sub

tryIt:
  m$ = b$(sendX, sendY) + Mid$("abcdefgh", emptyX, 1) + LTrim$(Str$(emptyY))
  If Right$(h$, 2) <> Mid$("abcdefgh", sendX, 1) + LTrim$(Str$(sendY)) Then
    h$ = h$ + ":" + m$
    saveEmptyX = emptyX: saveEmptyY = emptyY
    b$(emptyX, emptyY) = b$(sendX, sendY)
    b$(sendX, sendY) = ""
    emptyX = sendX: emptyY = sendY

    moveIt

    emptyX = saveEmptyX: emptyY = saveEmptyY
    b$(sendX, sendY) = b$(emptyX, emptyY)
    b$(emptyX, emptyY) = ""
    h$ = Left$(h$, Len(h$) - 4)
  End If
Return

End Sub

Challenge:

What's the cheat in the program?

 


  Posted by Charlie on 2008-07-24 15:07:28
Please log in:
Login:
Password:
Remember me:
Sign up! | Forgot password


Search:
Search body:
Forums (0)
Newest Problems
Random Problem
FAQ | About This Site
Site Statistics
New Comments (4)
Unsolved Problems
Top Rated Problems
This month's top
Most Commented On

Chatterbox:
Copyright © 2002 - 2017 by Animus Pactum Consulting. All rights reserved. Privacy Information