Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 12 Next capture
2021 2022 2023
1 capture
12 Jun 22 - 12 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
  • Help Room /
avatar image
0
Question by Metalhawk93 · Feb 22, 2017 at 01:45 AM · scripting problemc++conversion

Converting Pseudocode into C#

Hello, so I'm recently trying to learn how Pseudocode works, and I want to it to work in unity3d. However, Unity only work with C# and Javascript, so the only way to do that is try to make a script that converts Pseudocode to either C# or Js. So far I've writen down a simple script based on an example I've found on converting Pseudocode to C#.

 using UnityEngine;
 using System.Collections;
 
 public class PseudocodeConverter : MonoBehaviour {
 
     class Program
     {
        static void Main()
        {
           // Get the value for N
           Console.Write("Please enter a positive integer: ");
           int N;
           int.TryParse(Console.ReadLine(), out N);
           if (N <= 0)
           {
              Console.WriteLine("{0} isn't a perfect number", N);
              return;
           }
 
           // Initialize sum of the divisors & divison
           int SumOfDivisors = 1;
           int Candidate = 2;
 
           // Consider all possible divisors
           while(Candidate <= N/2)
           {
              int R = N - (N/Candidate) * Candidate;
              if (R == 0) SumOfDivisors += Candidate;
              Candidate++;
           }
 
           // Check the results 
           if (SumOfDivisors == N)
           {
              Console.WriteLine("{0} is a perfect number", N);
           }
           else
           {
              Console.WriteLine("{0} isn't a perfect number", N);
           }
        
           Console.ReadKey();
        }
 
 }

Of course as you can see, there are a lot of errors that need to be dealt with, and I'm still relatively new to coding. In any case though, can anyone point out what need to be corrected here? I would really appreciate it.

Comment
Add comment · Show 3
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image oStaiko · Feb 22, 2017 at 06:45 AM 2
Share

You do know Pseudocode isn't an actual language, and is really just short hand gibberish, right...? I even checked the Wiki to make sure some new language wasn't just invented. Creating your own coding language isn't an ideal thing here. You want to write files for your game in 'pseudocode', and then have a c# file read them and run your game from them. Sure it is possible, but just because you can doesn't mean it's at all a good idea. It'll be inefficient, take a lot more time to develop, and you'll still have to learn c# anyways to be able to code it. Just, learn and go with c#, and you'll save yourself the struggle

avatar image Metalhawk93 oStaiko · Feb 22, 2017 at 07:31 AM 0
Share

I suppose your right about that, It's just I'm having a hard time trying to figure out what kind of C# script I should make for the Game I'm trying to make. You see I want to create a game that mimics the Pseudo 3D Raster effects that where used often in early games, specifically arcade racing titles from the 80's and 90's. Do you know what I mean?

avatar image Tourist Metalhawk93 · Feb 22, 2017 at 09:49 AM 0
Share

You will have to write the same script in C# that you would have done in PseudoCode.

0 Replies

· Add your reply
  • Sort: 

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

119 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

NEED TO KNOW IF THIS IS POSSIBLE AND IF SO ANY ADVICE? 1 Answer

Why ain't this working? 1 Answer

Cant loop through a List 2 Answers

Unity console gives me various errors when I try to solve Unexpected symbol `end-of-file' 0 Answers

Renderer.materials not working in void update() 2 Answers


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges