Mallard's recent activity

  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. Comment on Eminem - Killshot (2018) in ~music

    Mallard
    Link Parent
    MGK might respond. Eminem likely won't: "I'm doin' this once."

    MGK might respond. Eminem likely won't: "I'm doin' this once."

    2 votes
  3. Comment on Write a quick poem! in ~creative

    Mallard
    Link
    I bought this mechanical keyboard for gaming, for highscores, killstreaks, noob-shaming, for no-scopes, low-blows, fast aiming, quick-flicks, neat-tricks and flag-claiming. Although the reality...

    I bought this mechanical keyboard for gaming,
    for highscores, killstreaks, noob-shaming,
    for no-scopes, low-blows, fast aiming,
    quick-flicks, neat-tricks and flag-claiming.

    Although the reality that I'm now hating
    is that I'm still worse than the players I'm facing,
    so I'll get back to programme-creating,
    and that odd bit of copy-and-pasting.

    5 votes
  4. Comment on Programming Challenge: Make a game in 1 hour! in ~comp

    Mallard
    Link Parent
    Thanks for checking it out. Squares are the square numbers: 1, 4, 9, 16 and 25. No odds because I feel that would be too straight-forward. The primes cover a good portion of the odds and requires...

    Thanks for checking it out.

    Squares are the square numbers: 1, 4, 9, 16 and 25.

    No odds because I feel that would be too straight-forward. The primes cover a good portion of the odds and requires a touch more brain power.

    Tweaks I would have liked to have is gravity, and/or pre-made levels that are completely solvable, instead of random values.

    1 vote
  5. Comment on Show off your Tasker profiles! in ~talk

    Mallard
    Link
    My only profile simply messages my girlfriend when my battery reaches 10%. It's handy.

    My only profile simply messages my girlfriend when my battery reaches 10%. It's handy.

    1 vote
  6. Comment on Programming Challenge: Make a game in 1 hour! in ~comp

    Mallard
    Link Parent
    Gulp. Got to upload it to...somewhere.

    1 hour, 44 minutes ago

    Gulp. Got to upload it to...somewhere.

    3 votes
  7. Comment on Programming Challenge: Make a game in 1 hour! in ~comp

    Mallard
    (edited )
    Link
    Okay, let's do this. Although I'm not the most experienced with p5.js, it's going to be my choice with such a short time frame. I don't know whether to include initial thinking time within the...

    Okay, let's do this.

    Although I'm not the most experienced with p5.js, it's going to be my choice with such a short time frame.

    I don't know whether to include initial thinking time within the hour, but I guess I'll decide that at the 59 minute mark.

    Here it is: https://thimbleprojects.org/mallard/535395/

    Instructions:

    --Select a mode using the keys at the bottom of the screen (or LEFT and RIGHT arrow keys to cycle through).
    -- Click tiles to create a chain of numbers that match your selected mode.
    -- Press ENTER to score your chain.
    -- Chains are valid if every tile in the chain has a neighbour also in the chain. Each tile has 4 neighbours: up, down, left and right. Chains must have at least 3 tiles.
    --The first 3 tiles in a chain are worth 100 points, then each extra tile is worth 100 than the previous, e.g. A chain of 7 is worth 100 + 100 + 100 + 200 + 300 +400 + 500 = 1700 points.

    So that was a little intense. I'm really proud of it. Game design is flawed because a chain of even numbers is likely to be rather large - I'd have liked to have solved this before submitting, as well as the weird score text bug, but the time was up. I also wanted to add 'gravity' when tiles are deleted, but that quickly got cut due to time.

    Took me a bit longer than expected to get setup (and I've been doing a lot of python recently so that kept creeping in), but once I was off I had good pace. I thought checking for valid chains would be rather 'heavy' to do, but it turned to be pretty simple, and I'm really happy with the implementation. (Just noticed that the logic for the chains is flawed too. Oh dear.)

    Thanks for the challenge.

    9 votes
  8. Comment on Programming Mini-Challenge: TicTacToeBot in ~comp

    Mallard
    Link Parent
    How do you set your IDE to work with pure dark magic?

    How do you set your IDE to work with pure dark magic?

  9. Comment on Tag Use in ~tildes

    Mallard
    Link Parent
    Uh-oh. streaming.twitch ?

    Uh-oh.

    streaming.twitch
    

    ?

  10. Comment on Programming Mini-Challenge: TicTacToeBot in ~comp

    Mallard
    Link Parent
    This was super interesting. Never seen Kotlin before, as far as I remember. I've been thinking about how the solutions in this thread would extend to n x n boards. This solution seems to have the...

    This was super interesting. Never seen Kotlin before, as far as I remember.

    I've been thinking about how the solutions in this thread would extend to n x n boards. This solution seems to have the least hard-coded parts. Cool.

    1 vote
  11. Comment on Programming Mini-Challenge: TicTacToeBot in ~comp

    Mallard
    Link Parent
    It wasn't a golfing challenge but by all means "golf" away!

    It wasn't a golfing challenge but by all means "golf" away!

  12. Comment on Programming Mini-Challenge: TicTacToeBot in ~comp

    Mallard
    Link Parent
    Line 9: if board[0][0] == board[1][1] == board[1][1] == board[2][2] Is the middle check needed?

    Line 9:

    if board[0][0] == board[1][1] == board[1][1] == board[2][2]
    

    Is the middle check needed?

    1 vote
  13. Comment on Programming Mini-Challenge: TicTacToeBot in ~comp

    Mallard
    Link Parent
    Defining your win positions as strings and casting to int is very clean. I like it. My first solution used slices too and I agree that your second solution is nicer.

    Defining your win positions as strings and casting to int is very clean. I like it.

    My first solution used slices too and I agree that your second solution is nicer.

    3 votes
  14. Comment on Programming Mini-Challenge: TicTacToeBot in ~comp

    Mallard
    Link Parent
    We only care which player, if any, has won - yes.

    We only care which player, if any, has won - yes.

    2 votes
  15. 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
  16. Comment on <deleted topic> in ~creative

    Mallard
    (edited )
    Link Parent
    I was. The terminal only accepted the first eight words and I liked the "ready." hanging there. Apologies for the confusion. E: You thought I wanted the > symbol there to denote a computer...

    I was. The terminal only accepted the first eight words and I liked the "ready." hanging there. Apologies for the confusion.

    E: You thought I wanted the > symbol there to denote a computer terminal. I getcha now! I wanted the formatting to denote the terminal.

    1 vote
  17. Comment on <deleted topic> in ~creative

    Mallard
    Link Parent
    'ready' was the ninth word. I'll add some punctuation to try and make it clearer! (E: Hmm... I'm unsure on that one.)

    "So, again, to clarify, you only have eight words".

    'ready' was the ninth word.

    I'll add some punctuation to try and make it clearer! (E: Hmm... I'm unsure on that one.)

  18. Comment on <deleted topic> in ~creative

    Mallard
    (edited )
    Link
    "So, again, to clarify, you only have eight words". Jonathan stood, arched over a keyboard with his finger hovering over the ENTER key, his neck straining to see the client. "Okay, Sir, I'm going...

    "So, again, to clarify, you only have eight words".

    Jonathan stood, arched over a keyboard with his finger hovering over the ENTER key, his neck straining to see the client.

    "Okay, Sir, I'm going to start."

    'Buy now to ensure your goodbyes' was the advertising slogan. Rich men would pay millions of credits to have their consciousness maintained for one final message.

    Jonathan knew how this would turn out. He'd seen it many times.

    The client spoke, quivering, and the transcription appeared on the screen.

    I don't know what to say. I'm not

    ready.

    A beep. A message appeared: TRANSFERED.

    2 votes
  19. Comment on What happened today that you want to share? in ~talk

    Mallard
    Link Parent
    There are some ups and downs in this thread and this got a good laugh from me. I imagine it pouring down with rain and you telling off your robotic friend as it beeps happily around your room.

    I got shut out of my house by my robot vacuum

    There are some ups and downs in this thread and this got a good laugh from me. I imagine it pouring down with rain and you telling off your robotic friend as it beeps happily around your room.

    2 votes
  20. Comment on What little-known online co-op games do you enjoy and why? in ~games

    Mallard
    Link
    I remember having Clandestine on my wishlist for a while, whilst it was in Early Access and the price was a little high. I guess you recommend it then? Do you suggest 1 player sticking to one role...

    I remember having Clandestine on my wishlist for a while, whilst it was in Early Access and the price was a little high. I guess you recommend it then? Do you suggest 1 player sticking to one role throughout the campaign or switching after every level or so?

    Also, I remember playing Hacktag when it must have been a free demo on itch, or something. I didn't know it had released, so thanks!

    2 votes