• Activity
  • Votes
  • Comments
  • New
  • All activity
  • Showing only topics with the tag "mini challenge". Back to normal view
    1. Programming Mini-Challenge: KnightBot

      Another programming mini-challenge for you. It's been a month since the first one and that seemed to be rather successful. (I appreciate that there are other challenges on here but trying to sync...

      Another programming mini-challenge for you. It's been a month since the first one and that seemed to be rather successful. (I appreciate that there are other challenges on here but trying to sync with them seems tricky!)

      A reminder:
      I'm certain that many of you might find these pretty straight forward, but I still think there's merit in sharing different approaches to simple problems, including weird-and-wonderful ones.


      KnightBot


      Info

      You will be writing a small part of a Chess program, specifically focusing on the Knight, on an 8 x 8 board.


      Input

      The top-left square of the board will have index 0, and the bottom-right square will have index 63.

      • The first input is the starting square of the knight.
      • The second input is the requested finishing square of the knight.
      • The third input is the number of maximum moves allowed.

      Output

      The expected outcome is either True or False, determined by whether or not the Knight can reach the requested finishing square within the number of allowed moves when stating on the starting square.

      e.g. The expected output for the input 16, 21, 4 is True since the Knight can move 16->33->27->21, which is 3 moves.
      

      Extensions

      Some additional ideas for extending this challenge...

      1. Instead of an 8x8, what if the board was nxn?
      2. Instead of "within x moves", what if it was "with exactly x moves?"
      3. Instead of a traditional Knight's move (2 long, 1 short), what if it was n long and m short?
      4. What if the board was infinite?
      5. What if the board looped back around when crossing the edges? (e.g. the square to the right of 7 is 0)
      17 votes
    2. Programming Mini-Challenge: TicTacToeBot

      I've seen the programming challenges on ~comp as well as quite a few users who are interested in getting started with programming. I thought it would be interesting to post some 'mini-challenges'...

      I've seen the programming challenges on ~comp as well as quite a few users who are interested in getting started with programming. I thought it would be interesting to post some 'mini-challenges' that all could have a go at. I'm certain that many of you might find these pretty straight forward, but I still think there's merit in sharing different approaches to simple problems, including weird-and-wonderful ones.

      This is my first post and I'm a maths-guy who dabbles in programming, so I'm not promising anything mind-blowing. If these gain any sort of traction I'll post some more.

      Starting of with...


      TicTacToeBot


      Info

      You will be writing code for a programme that will check to see if a player has won a game of tic-tac-toe.


      Input

      The input will be 9 characters that denote the situation of each square on the grid.

      • 'X' represents the X-player has moved on that square.
      • 'O' represents the O-player has moved on that square.
      • '#' represents that this square is empty.

      Example:

      |O| |X|
      |X|X|O|    The input for this grid will be O#XXXOO##
      |O| | |
      

      Output

      The expected output is the character representing the winning player, or "#" if the game is not won.

      (e.g. The expected output for the example above is '#' since no player has won)


      29 votes