r/programmingrequests • u/[deleted] • Aug 07 '17
Practice Challenges
Hi,
Im a novice coder with not very much experience.
I'm currently in a position where I want to expand my capabilities, so that I can put my ability to more use. I want to find more challenges to teach myself how to become a better programmer, but with my current skills, Im not sure what a proper "step up" would be.
Currently, my abilities mostly amount to HTML scrubbing and file manipulation in python. I also know very very basic bash scripting for linux shell. My longest python file was 150 lines of code that simply tracks users posts and downloads media to a respective folder.
Ive skimmed over other languages such as html and SQL, but Im mostly using python.
If anyone has a good idea for a challenge to help me build my skills, Id appreciate it.
Some areas of interest are, Object Oriented Programming, Artificial Inteligence, Networking, Peripheral interaction, and Gaming
Thanks for reading!
2
u/serg06 Aug 07 '17
I'll give you a very hard challenge:
2 players, Dan and Larry, play on a grid board of size N by N. They both start on random spots on the board.
Dan moves first: For each move, Dan can only move diagonally up and right. If he's up against then right wall, then he can only move up. If Dan reaches the top of the board, he wins.
Larry moves second: For each move, he moves like a knight in chess: 1 square in one (non-diagonal) direction, and 2 squares in a different (non-diagonal) direction. If Larry lands on Dan, Larry wins.
You must create a function in your program that figures out who will win the game, and in how many moves. Assume that Larry is a robot that plays perfectly every time and, if he can win from his starting position, he will win.
GIVEN PARAMETERS:
The size of the board (A single number N, meaning the board will be an N by N board.)
The starting horizontal coordinate of Dan (The left-most position is 0, and the most right-most position is N-1).
The starting vertical coordinate of Dan (The bottom-most position is 0, and the top-most position is N-1).
The starting horizontal coordinate of Larry
The starting vertical coordinate of Larry
OUTPUT:
The function must return a string as follows: "<Name> wins in <number> moves."
RUNTIME:
If the board is of size N, the function must have no more than a c*N2 runtime. For example, if a board of size 2 takes no more than 5*22 seconds to calculate, then a board of size 100 should take no more than 5*1002 seconds to calculate.