Hey there! Sign in to join this conversationNew here? Join for free
    Offline

    1
    ReputationRep:
    Could someone send me a link of the whole python code ?
    Offline

    1
    ReputationRep:
    (Original post by Ash_All)
    Could someone send me a link of the whole python code ?
    https://en.wikibooks.org/wiki/A-leve...016_Exam_Resit
    Offline

    2
    ReputationRep:
    (Original post by uGo1001)
    Has anyone actually made a solution for this?
    Yeah, all you have to do is alter the CheckIfMoveIsValid module.
    The code below is for Python 3+ but it should be pretty understandable
    Code:
    def CheckIfMoveIsValid(Board, Move, P1, P2, HumanPlayersTurn):
        Row = Move % 10
        Column = Move // 10
        MoveIsValid = False
        if Board[Row][Column] == " ":
            if HumanPlayersTurn:
               Board[Row][Column] = P1
            else:
               Board[Row][Column] = P2
            Valid1 = CheckIfThereArePiecesToFlip(Board, BoardSize, Row, Column, 1, 0)
            Valid2 = CheckIfThereArePiecesToFlip(Board, BoardSize, Row, Column, -1, 0)
            Valid3 = CheckIfThereArePiecesToFlip(Board, BoardSize, Row, Column, 0, 1)
            Valid4 = CheckIfThereArePiecesToFlip(Board, BoardSize, Row, Column, 0, -1)
            if Valid1 == True or Valid2 == True or Valid3 == True or Valid4 == True:
               MoveIsValid = True
            else:
               Board[Row][Column] = " "
        return MoveIsValid
    Offline

    2
    ReputationRep:
    I have all solutions if anyone needs a last minute hand, only thing would be helpful is if anyone has the solution for quit/skip a turn (in VB.NET), or anyone thought about diffcult part A/B/C topics? Sound sampling is difficult but was last year I think, the variable types are pretty hard in part C also.
    Offline

    0
    ReputationRep:
    Has anyone done any of the problems in java? Especially fixing the invalid coordinates loop?
    Offline

    1
    ReputationRep:
    (Original post by KnightCode)
    why are confusing this??

    if (Board[Row, Column] == ' ' && ( CheckIfThereArePiecesToFlip(Boar d, BoardSize, Row, Column, 1, 0) == true || CheckIfThereArePiecesToFlip(Boar d, BoardSize, Row, Column, 0, 1) == true || CheckIfThereArePiecesToFlip(Boar d, BoardSize, Row, Column, -1, 0) == true || CheckIfThereArePiecesToFlip(Boar d, BoardSize, Row, Column, 0, -1) == true))

    thats all u need
    Except that doesn't actually let me make a move. When I tried that there was no place on the board which the game let me place a piece on. For some reason you have to put the piece in it's place before checking if all of the "CheckIfThereArePiecesToFlip " are true or else it doesn't work.
    • Thread Starter
    Offline

    2
    ReputationRep:
    How's everyone feeling for the exam tomorrow

    I'm a bit nervous but at the same time I feel confident that I'll be fine
    Offline

    0
    ReputationRep:
    (Original post by ollycostello)
    I have all solutions if anyone needs a last minute hand, only thing would be helpful is if anyone has the solution for quit/skip a turn (in VB.NET), or anyone thought about diffcult part A/B/C topics? Sound sampling is difficult but was last year I think, the variable types are pretty hard in part C also.
    Are all your solutions in vb.net. If so could you send them to me
    Thanks
    Offline

    2
    ReputationRep:
    Some more problems they may ask:

    - Only allowing the player to pick even board dimensions.
    - If the human, or computer can not place a piece down at the very end of the game, during the adjacent move implementation, empty spaces are left. If you would calculate the score in percentages, it would not calculate the empty space and minus it from BoardSize, hence an invalid percentage would be given. This could be a second part to the adjacent move question.
    Offline

    0
    ReputationRep:
    Okay, here's a harder question that I think may come up but I don't have any idea how to implement. In the actual Reverse game, the player is forced to skip a turn if no legal moves are possible and cannot skip a turn at any other point. Anyone got any ideas for this? I'm not sure how to check if no valid moves are possible.
    Offline

    1
    ReputationRep:
    When playing using the adjacency check, can you actually finish a game without filling out the board? I can't actually finish the game unless the board is filled with pieces
    Offline

    0
    ReputationRep:
    Oh, and note guys, the CheckIfThereArePiecesToFlip doesn't actually check if a flip is possible, it checks if there are adjacent pieces of the opponent next to the position you've specified.
    Offline

    1
    ReputationRep:
    (Original post by DodaWilliams)
    Okay, here's a harder question that I think may come up but I don't have any idea how to implement. In the actual Reverse game, the player is forced to skip a turn if no legal moves are possible and cannot skip a turn at any other point. Anyone got any ideas for this? I'm not sure how to check if no valid moves are possible.
    This has been done, check previous pages in the thread.
    Offline

    11
    ReputationRep:
    (Original post by uGo1001)
    Except that doesn't actually let me make a move. When I tried that there was no place on the board which the game let me place a piece on. For some reason you have to put the piece in it's place before checking if all of the "CheckIfThereArePiecesToFlip " are true or else it doesn't work.
    yeah, i tried it ur way and it worked. I think it makes sense, since it needs to know whos turn it is and who it is flipping.
    thanks for the help though and GL!
    Offline

    18
    ReputationRep:
    (Original post by DodaWilliams)
    Oh, and note guys, the CheckIfThereArePiecesToFlip doesn't actually check if a flip is possible, it checks if there are adjacent pieces of the opponent next to the position you've specified.
    Yes it does, it draws a line between the piece you have placed and the next piece you have.
    Offline

    0
    ReputationRep:
    Anyone know how to implement in Python an automatic skip if there are no more possible turns for the human or computer? Thanks
    Offline

    1
    ReputationRep:
    Can anyone actually finish a game using the adjacency check and have blank pieces left over? If a flip isn't possible, the code just stops instead of ending the game
    Offline

    0
    ReputationRep:
    (Original post by TercioOfParma)
    Yes it does, it draws a line between the piece you have placed and the next piece you have.
    Yeah, it was bug in my code, my bad
    Offline

    2
    ReputationRep:
    (Original post by StarStruck_98)
    Anyone know how to implement in Python an automatic skip if there are no more possible turns for the human or computer? Thanks
    I have implemented skipping a turn manually by the player. The automatic skip for the computer works for me, but in my opinion, implementing automatic skipping for a player is a bit pointless.

    If you were playing the real game, the board would not tell you: "Hey, you get no moves, I'm skipping for you". I made it so that the player can have a go, and get the option to skip if they wish too!
    Offline

    0
    ReputationRep:
    I found a website which lists a bunch of potential questions and give solutions in a range of languages:
    https://en.wikibooks.org/wiki/A-leve...er1_this_year)
 
 
 
  • See more of what you like on The Student Room

    You can personalise what you see on TSR. Tell us a little about yourself to get started.

  • Poll
    Would you like to hibernate through the winter months?
  • See more of what you like on The Student Room

    You can personalise what you see on TSR. Tell us a little about yourself to get started.

  • The Student Room, Get Revising and Marked by Teachers are trading names of The Student Room Group Ltd.

    Register Number: 04666380 (England and Wales), VAT No. 806 8067 22 Registered Office: International House, Queens Road, Brighton, BN1 3XE

    Quick reply
    Reputation gems: You get these gems as you gain rep from other members for making good contributions and giving helpful advice.