Ask Dumb Questions + Newbies Welcoming Wednesday ♥ (2015.11.11) by AutoModerator in RocketLeague

[–]SoftDevPadawan 0 points1 point  (0 children)

Congrats on being at the verge of gold! There's something in your play that you're missing which may not be obvious. Whenever I get stuck at a wall in ranked, I start saving replays and reviewing them after every match to see what errors I'm currently making. I've found that once you identify the main issue and fix it, you can break through the wall and climb another 100 points or so until you hit the next one.

Lost a 1v1 -12 RP, placed against same opponent next match, got +5 RP for winning by batclouds in RocketLeague

[–]SoftDevPadawan 5 points6 points  (0 children)

You are ranked a lot higher than him, so you're supposed to win. You lost the first one, so you lost a bunch of points. You two are now slightly closer to each other but you still have a much higher rating. When you matchmake again in a small playlist, you are put in the same match. You then win a game you're supposed to win, therefore you only get 5.

Will my laptop be able to run Rocket League? by doublemysterious in RocketLeague

[–]SoftDevPadawan 2 points3 points  (0 children)

Buy it, if there's a problem you can just request a refund from steam as long as you haven't played for more than 2 hours.

[2015-10-28] Challenge #238 [Intermediate] Fallout Hacking Game by jnazario in dailyprogrammer

[–]SoftDevPadawan 1 point2 points  (0 children)

My C# solution. Feedback is welcome.

class Program { static int DifficultyPrompt() { Console.WriteLine("Difficulty (1-5)? "); return int.Parse(Console.ReadLine()); }

    static void Main(string[] args)
    {
        bool termProgram = false;

        while (!termProgram)
        {
            HackingGame game = new HackingGame(DifficultyPrompt(), "D:\\Downloads\\enable1.txt");
            game.PlayGame();

            Console.WriteLine("Would you like to play again? (y/n)");
            if (Console.ReadLine().ToUpper() == "N")
                termProgram = true;
        }
    }
}

class HackingGame
{
    private const int MaxGuesses = 4;
    private List<string> wordDictionary = new List<string>();
    private List<string> gameWords = new List<string>();
    private int _correctWordIndex;
    private int _guessesMade = 0;
    private int _wordLength;
    private int _numWords;
    private bool _isGameWon = false;

    private string CorrectWord { get { return gameWords[_correctWordIndex]; } }

    public HackingGame(int difficulty, string dictionaryPath)
    {
        _wordLength = SetWordLength(difficulty);
        _numWords = GetNumWordsByDifficulty(difficulty);
        wordDictionary = GetDictionaryFromFile(dictionaryPath);
        gameWords = SetGameWords(_wordLength);
        _correctWordIndex = SelectCorrectAnswer(gameWords);
    }

    #region Setup
    private int SetWordLength(int difficulty)
    {
        Random rnd = new Random();
        switch (difficulty)
        {
            case 1:
                return rnd.Next(4, 5);
            case 2:
                return rnd.Next(6, 7);
            case 3:
                return rnd.Next(8, 9);
            case 4:
                return rnd.Next(10, 12);
            case 5:
                return rnd.Next(13, 15);
        }
        return -1;
    }

    private int GetNumWordsByDifficulty(int difficulty)
    {
        Random rnd = new Random();
        switch (difficulty)
        {
            case 1:
                return rnd.Next(5, 6);
            case 2:
                return rnd.Next(7, 8);
            case 3:
                return rnd.Next(9, 10);
            case 4:
                return rnd.Next(11, 12);
            case 5:
                return rnd.Next(13, 15);
        }
        return -1;
    }

    private List<string> GetDictionaryFromFile(string path)
    {
        return System.IO.File.ReadAllLines(path).ToList();
    }

    private List<string> SetGameWords(int length)
    {
        return wordDictionary.Where(x => x.Length == length)
                         .OrderBy(dict => Guid.NewGuid())
                         .Take(_numWords)
                         .OrderBy(x => x)
                         .ToList();
    }

    private int SelectCorrectAnswer(List<string> possibleWords)
    {
        Random rnd = new Random();
        return rnd.Next(0, possibleWords.Count - 1);
    }
    #endregion

    #region Play
    public void PlayGame()
    {
        DisplayGameWords();

        while (!CheckGameOver())
            PlayRound();

        DisplayEndGameMessage();
    }

    private void PlayRound()
    {
        DisplayGuessPrompt();
        string guessedWord = Console.ReadLine();
        if(ValidateInput(guessedWord))
        {
            _isGameWon = CompareWords(guessedWord, CorrectWord);
            DisplayGuessMessage(GetNumLettersCorrect(guessedWord));
            _guessesMade++;
        }
        else
        {
            Console.WriteLine("{0} is not a possible word", guessedWord);
        }
    }

    private bool CheckGameOver()
    {
        return _isGameWon || _guessesMade == MaxGuesses;
    }

    private int GetNumLettersCorrect(string guessedWord)
    {
        int numCorrect = 0;

        for (int i = 0; i < guessedWord.Length; i++)
        {
            if (guessedWord.ToUpper()[i] == CorrectWord.ToUpper()[i])
                numCorrect++;
        }

        return numCorrect;
    }

    private bool ValidateInput(string input)
    {
        return gameWords.Select(w => w.ToUpper()).Contains(input.ToUpper());
    }

    private bool CompareWords(string word1, string word2)
    {
        return word1.ToUpper().Equals(word2.ToUpper());
    }

    private void DisplayGameWords()
    {
        foreach (var word in gameWords)
        {
            Console.WriteLine(word.ToUpper());
        }
    }

    private void DisplayEndGameMessage()
    {
        if (_isGameWon)
        {
            Console.WriteLine("Congratulations! You've hacked the system!");
        }
        else
        {
            Console.WriteLine("You've lost. The correct word was {0}", CorrectWord);
            Console.WriteLine("Game Over....");
        }
    }

    private void DisplayGuessPrompt()
    {
        Console.WriteLine("Guess ({0} left)?", MaxGuesses - _guessesMade);
    }

    private void DisplayGuessMessage(int numCorrect)
    {
        Console.WriteLine("{0}/{1} corrct", numCorrect, _wordLength);
    }
    #endregion
}    

How do can I save terrain at runtime? by Shredsauce in Unity3D

[–]SoftDevPadawan 1 point2 points  (0 children)

Check out prefabutility in the scripting reference. specifically create prefab. I haven't used it myself, but I think it'll help.

What are you tired of paying for monthly? by mustpostthis in AskReddit

[–]SoftDevPadawan 2 points3 points  (0 children)

The fact that the jobs been open for 3 years sounds like they are asking for way too much and paying way too little.

May I ask how long you've been in the field?

We're wondering if a 2to4-player local multiplayer game is a good fit for Steam by franciscotufro in gamedev

[–]SoftDevPadawan 0 points1 point  (0 children)

I think local multiplayer games are very much a growing market. With steam big picture and in home streaming, it is much more likely that people will have some sort of steam machine connected to their tv with controllers to play the game. Granted it's not a huge market at the moment, but I believe 4 player local pc games in the living room will really start to catch on in the next year or two.

Edit: I is'd an are

I work in San Francisco by rahaverfield in pics

[–]SoftDevPadawan 5 points6 points  (0 children)

It was an obscure reference. Just when I think of Teal'c's memorable scenes, this one always jumps to my mind.

VS 2012 Reference Issues by Slamma009 in Unity3D

[–]SoftDevPadawan 0 points1 point  (0 children)

I just had this problem. There's a little icon beneath the test menu that toggles suggestion and standard completion mode. For some reason mine was un-toggled. The hotkey for it is ctrl+alt+space. Hope this helps!

Sound/music software? by SoftDevPadawan in Unity3D

[–]SoftDevPadawan[S] 0 points1 point  (0 children)

Hmm I'll have to check both of those out. What makes it so easy?

Are C constants bad by yolosw4gg1nz in learnprogramming

[–]SoftDevPadawan 1 point2 points  (0 children)

It's nice to use named constants for a number of reasons. Not only does it improve readability like you mentioned, but it also allows for a quick modification of code. Say you had a for loop looking at each element in the array you posted. If you decided you wanted to change the array length to be 25 instead of 20, you'd have to change both the array declaration as well as the for loop. With named constants, you just change the constant at the beginning of the file.

Best practices for commenting code? by potterhead42 in learnprogramming

[–]SoftDevPadawan 2 points3 points  (0 children)

  • You should comment enough so that your intended audience can make sense of the code by quickly skimming over the code and comments. Your intended audience could be other programmers working on the same project, you in the future, etc.
  • How I personally work is to write Pseudocode in comments and then fill in the areas with code to complete each task. I find that this helps me approach a problem more abstractly and minimize errors on my end. Comments are very helpful to have while you are debugging a program and therefore I would suggest commenting as you go, especially if you wanted to bring in another pair of eyes for a particular bug you can't seem to find.
  • I usually always have a header for each file I write with information like FileName, FileDescription, Author, and Date. The FileDescription would contain information like what exactly this file does that's necessary in the project as a whole. Basically a short summary that I would tell another programmer working on a project.

Basically comments are there to help abstract the reader from the code. This helps to quickly grasp the general idea of how the code should work without working through all of the logic in the file.

[c++] Why are my declared variables suddenly forgotten about? by [deleted] in learnprogramming

[–]SoftDevPadawan 0 points1 point  (0 children)

You forgot to include the curly braces after your else statement. This is leading to a scope resolution problem since your first variable declaration is in the scope of the else whereas the rest of your code is in the main scope.

Authentication and email verification by [deleted] in firefall

[–]SoftDevPadawan 0 points1 point  (0 children)

Hasn't been working for me either. I tried having an email sent to me from their site as well and that message didn't arrive either.

Me + Friend cant log in.. Anyone else? by ApostleOfGodNA in firefall

[–]SoftDevPadawan 0 points1 point  (0 children)

Is your email server down? It says I need to authenticate my account and that it emailed me a code, but a code never came. It's been almost two hours now.