Mod The Sims
Page 474 of 474

Mod The Sims (https://modthesims.info/index.php)
-   Sims 2 (https://modthesims.info/forumdisplay.php?f=558)
-   -   What did you discover today while playing the sims? v2 (https://modthesims.info/showthread.php?t=574022)

AndrewGloria 15th Dec 2024 7:31 AM

Quote: Originally posted by kestrellyn
A function isn't "algorithm-based", it's just a completely different thing. You can call a function, you can't call an algorithm. You can pass arguments to a function, you can't pass arguments to an algorithm. A function can return a value, and algorithm cannot. A function gets assigned a stack frame that's put on a call stack, an algorithm does not. Etc.
I don't like to disagree with you but your understanding of these words is very different to what I was taught when I learned programming at a Scottish university in the 1990s. As I understand it an algorithm is set of logical steps that underlie the working of a procedure in a computer program. Algorithms are not language-dependent and can be realised in a variety of programming languages. Indeed, if you manually perform each of the logical steps in the algorithm in the proper sequence, you are still using the algorithm even though you are not using a computer at all. Now I was taught to program in COBOL at university but in fact I never used COBOL commercially at all. Most of the commercial programming that I did was in various versions of Visual Basic, including "Access Basic" which is what Microsoft called the version used in Access 2. Now in Visual Basic a function is a procedure that returns a value, which can be numeric, but can also be a string. (A Sub [short for "sub-procedure"] in contrast is a named procedure that does not return a value, though it may manipulate files or bits of the user interface.) Now, when I was working as a freelance database programmer, I wrote a program for generating realistic looking dummy data to populate demonstration database programs. Now that I am retired I no longer use the program in full, but I still use some functions in it to generate pseudo-random names for Sims. So, if I have created a male Sim in CAS, and want a name for him, I will open the Immediate Window in Microsoft Access and type "PRINT CreateSurname". This will call the named function CreateSurname() that I wrote years ago. It in turn will return a string containing pseudo-random name that it retrieves from an internal database table. Similarly I can then call the procedures CreateMaleChristianName() and CreateFemaleChristianName() and it will generate a first name for him and one for his sister. Thus:
Code:
PRINT CreateSurname
Anderson

PRINT CreateMaleChristianName
George

PRINT CreateFemaleChristianName
Madeleine

(I might actually just use these names for the next CAS Sims that I make!)

As I understand, in some programming languages all procedures are functions as they all return a value (possibly just binary true if the procedure succeeds and binary false if it fails). Now I don't fully understand what you mean by "stack frame" and "call stack", but these terms seem to refer to a specific computer architecture, or family of architectures, whereas the words algorithm and function as I understand them are much more general than that. Indeed you can use an algorithm without having a computer at all.

I think what you have posted is probably true in some programming languages, but it is not always true.

FranH 15th Dec 2024 12:36 PM

I discovered yet again that you have to keep an eye on what you put into your game even now as a mod.

My game has been so far flawless and working well. Then I put a mod about traits that I thought would be a good addition to the game.

Then I found out it was not. Pixels started doing 'the spin' continuously-which of course, indicates that something is wrong. (it's the other version of the 'jump bug') and when I remembered it, to take out the mod, it stopped.

It'd been so long since I'd had any bad actions that I'd forgotten to be careful.

Complacency has a price.

The game can be tough as nails with throwing things into it, but it's still 20 years old.

iforgot 15th Dec 2024 2:30 PM

2 Attachment(s)
Quote: Originally posted by kestrellyn
A function isn't "algorithm-based", it's just a completely different thing. You can call a function, you can't call an algorithm. You can pass arguments to a function, you can't pass arguments to an algorithm. A function can return a value, and algorithm cannot. A function gets assigned a stack frame that's put on a call stack, an algorithm does not. Etc.

Alright, I hate to do this but I'm going to have to.

You are talking about computer programming, I am talking about computer science. They are not the same. For example, if you look at what I provided previously you can see python was only used as a means to show how it looks in code, the point was never the language - in fact that part you saw comes from a course where knowing python among other languages is a prerequisite - they are not teaching you the language.

It's clear you haven't studied computer science, because if you had you wouldn't be making this argument. I can't legally provide the study books in whole (copyright). But I can show you this, which sums it up nicely what I am talking about, this comes from a university level computer science book at level 1 (year 1, the previous book was year 2 - so this one is simpler). This is not about algorithms as you are thinking of them.




Hopefully, you can see now by looking at my original post about algorithms and this text as to how they relate. A BHAV, while a function still has an algorithm in the sense of instructions to what it needs to do, it takes a step, performs it, then moves onto the next step as I demonstrated here. Now, can we please cease this unnecessary and pointless argument?

kestrellyn 15th Dec 2024 2:53 PM

Quote: Originally posted by AndrewGloria
I don't like to disagree with you but your understanding of these words is very different to what I was taught when I learned programming at a Scottish university in the 1990s. As I understand it an algorithm is set of logical steps that underlie the working of a procedure in a computer program. Algorithms are not language-dependent and can be realised in a variety of programming languages. Indeed, if you manually perform each of the logical steps in the algorithm in the proper sequence, you are still using the algorithm even though you are not using a computer at all. Now I was taught to program in COBOL at university but in fact I never used COBOL commercially at all. Most of the commercial programming that I did was in various versions of Visual Basic, including "Access Basic" which is what Microsoft called the version used in Access 2. Now in Visual Basic a function is a procedure that returns a value, which can be numeric, but can also be a string. (A Sub [short for "sub-procedure"] in contrast is a named procedure that does not return a value, though it may manipulate files or bits of the user interface.) Now, when I was working as a freelance database programmer, I wrote a program for generating realistic looking dummy data to populate demonstration database programs. Now that I am retired I no longer use the program in full, but I still use some functions in it to generate pseudo-random names for Sims. So, if I have created a male Sim in CAS, and want a name for him, I will open the Immediate Window in Microsoft Access and type "PRINT CreateSurname". This will call the named function CreateSurname() that I wrote years ago. It in turn will return a string containing pseudo-random name that it retrieves from an internal database table. Similarly I can then call the procedures CreateMaleChristianName() and CreateFemaleChristianName() and it will generate a first name for him and one for his sister. Thus:
Code:
PRINT CreateSurname
Anderson

PRINT CreateMaleChristianName
George

PRINT CreateFemaleChristianName
Madeleine

(I might actually just use these names for the next CAS Sims that I make!)

As I understand, in some programming languages all procedures are functions as they all return a value (possibly just binary true if the procedure succeeds and binary false if it fails). Now I don't fully understand what you mean by "stack frame" and "call stack", but these terms seem to refer to a specific computer architecture, or family of architectures, whereas the words algorithm and function as I understand them are much more general than that. Indeed you can use an algorithm without having a computer at all.

I think what you have posted is probably true in some programming languages, but it is not always true.


Whether all functions return a value or not is language-dependent, which is why I said that they could return one. For example, in C and C++ you can define functions that don't return a value explicitly using "void", whereas in Python, every function returns a value and will just return the special value None if you don't specify something else. However, every language has at least some functions that return a value.

Stack frames and the call stack are not language-specific, they are a general feature of all computer architectures, as far as I'm aware. You can see what a call stack is by looking at a Sims 2 error log, actually:

Code:
Object id: 197
name: N001_User00011 - Don
Stack size: 13
Error: Reference to tree tree parameter when no parameter exists.
Iterations: 188
  Frame 12:
    Stack Object id: 14
    Node: 13
    Tree: id 4110 name 'Phone - Invite Sim Over' version -32736
    from PhoneCall_Sim2Sim
    Prim state: 0
    Params: 24    Locals: 0 25 0 0 0
  Frame 11:
    Stack Object id: 14
    Node: 50
    Tree: id 4099 name 'Phone - Outgoing Call' version -32703
    from PhoneCall_Sim2Sim
    Prim state: 0
    Params: 0 24 0    Locals: 14 0 -14569 29094
  Frame 10:
    Stack Object id: 24
    Stack Object name: Phone Call - Sim2Sim - Sim Calls
    Node: 2
    Tree: id 4098 name 'CT - Handle Call' version -32735
    from PhoneCall_Sim2Sim
    Prim state: 0
    Params: 0 0    Locals:
  Frame 9:
    Stack Object id: 24
    Stack Object name: Phone Call - Sim2Sim - Sim Calls
    Node: 6
    Tree: id 8279 name 'Calls - Handle Call (Sub-Type Known)' version -32754
    from PhoneCallGlobals
    Prim state: 1
    Params: 142 0 0 160    Locals: 24
  Frame 8:
    Stack Object id: 23
    Stack Object name: Phone Call - Sim2Sim
    Node: 1
    Tree: id 4098 name 'CT - Handle Call' version -32735
    from PhoneCall_Sim2SimManager
    Prim state: 0
    Params: 0 0 160    Locals: 0
  Frame 7:
    Stack Object id: 23
    Stack Object name: Phone Call - Sim2Sim
    Node: 3
    Tree: id 8270 name 'Call - Handle Call' version -32756
    from PhoneGlobals
    Prim state: 1
    Params: 142 0 0 160    Locals: 0 0
  Frame 6:
    Stack Object id: 160
    Stack Object name: Phone - Base - Wall
    Node: 10
    Tree: id 8271 name 'Phone - Call' version -32755
    from PhoneGlobals
    Prim state: 0
    Params: 160 142 0 0    Locals: 0
  Frame 5:
    Stack Object id: 160
    Stack Object name: Phone - Base - Wall
    Node: 32
    Tree: id 8240 name 'Interaction - Call' version -32735
    from PhoneGlobals
    Prim state: 0
    Params: 142 0 0 0    Locals: 0 160
  Frame 4:
    Stack Object id: 197
    Stack Object name: N001_User00011 - Don
    Node: 5
    Tree: id 281 name 'Wait For Notify' version 8
    from global
    Prim state: 1
    Params: 0 1    Locals:
  Frame 3:
    Stack Object id: 197
    Stack Object name: N001_User00011 - Don
    Node: 1
    Tree: id 8282 name 'Function - Main - Check Queue' version 50
    from PersonGlobals
    Prim state: 0
    Params:    Locals: 160
  Frame 2:
    Stack Object id: 197
    Stack Object name: N001_User00011 - Don
    Node: 3
    Tree: id 8283 name 'Function - Main - Loop' version 96
    from PersonGlobals
    Prim state: 0
    Params: 3 20 1    Locals: 0
  Frame 1:
    Stack Object id: 197
    Stack Object name: N001_User00011 - Don
    Node: 6
    Tree: id 8193 name 'Function - Main' version 118
    from PersonGlobals
    Prim state: 0
    Params:    Locals: 3 20 0
  Frame 0:
    Stack Object id: 197
    Stack Object name: N001_User00011 - Don
    Node: 1
    Tree: id 4096 name 'Function - Main' version 2
    from TemplatePerson
    Prim state: 0
    Params:    Locals:


Here you can see a call stack with 12 stack frames, which are labeled starting with "Frame 12:" at the top to "Frame 0:" at the bottom. Each stack frame represents a function call: "Tree" identifies the name of the function, "Node" identifies the line the function is currently on, "Params" and "Locals" indicate the current values of the function's parameters and local variables. Whenever a new function is called, another stack frame is added to the top of the list to represent that function; whenever one finishes, it gets removed, also off the top of the call stack, since only the top function is currently actively executing. So in this case, with this stack frame, if we look at this starting from Frame 5, we see that:

The "Interaction - Call" function was executing, when it reached line 32:
It called the "Phone - Call" function, when that function reached line 10:
It called the "Call - Handle Call" function, when that function reached line 3:
It called the "CT - Handle Call" function, when that function reached line 1:
It called "Calls - Handle Call (Sub-Type Known)" function, when that function reached line 6:
It called the "CT - Handle Call" function, when that function reached line 2:
It called the "Phone - Outgoing Call" function, when that function reached line 50:
It called the "Phone - Invite Sim Over" function", and when that function reached line 13, it threw an error and generated this log, which it was able to do because the game keeps track of all this in the call stack.

When you write code in any other language that uses any kind of functions, the computer also builds this kind of call stack and will generally output it when errors are encountered, as in this case.

kestrellyn 15th Dec 2024 2:57 PM

Quote: Originally posted by iforgot
Alright, I hate to do this but I'm going to have to.

You are talking about computer programming, I am talking about computer science. They are not the same. For example, if you look at what I provided previously you can see python was only used as a means to show how it looks in code, the point was never the language - in fact that part you saw comes from a course where knowing python among other languages is a prerequisite - they are not teaching you the language.

It's clear you haven't studied computer science, because if you had you wouldn't be making this argument. I can't legally provide the study books in whole (copyright). But I can show you this, which sums it up nicely what I am talking about, this comes from a university level computer science book at level 1 (year 1, the previous book was year 2 - so this one is simpler). This is not about algorithms as you are thinking of them.




Hopefully, you can see now by looking at my original post about algorithms and this text as to how they relate. A BHAV, while a function still has an algorithm in the sense of instructions to what it needs to do, it takes a step, performs it, then moves onto the next step as I demonstrated here. Now, can we please cease this unnecessary and pointless argument?


Your book does not say anything I haven't said here. I'm saying that an algorithm is not the same thing as a function, which is true, and is not in any way contradicted by anything in your book, the book is literally just describing what an algorithm is. I have multiple degrees in computer science, by the way.

iforgot 15th Dec 2024 4:10 PM

Quote: Originally posted by kestrellyn
Your book does not say anything I haven't said here. I'm saying that an algorithm is not the same thing as a function, which is true, and is not in any way contradicted by anything in your book, the book is literally just describing what an algorithm is. I have multiple degrees in computer science, by the way.

.... I give up.

You are intentionally missing my points.

Have a good day. Topp if you have further questions or need further information, please direct them to kestrellyn.

FranH 15th Dec 2024 5:13 PM

Now that the semi and former professional programmers are done with discussing computer functions, I'll relate what I found in the game today-that I discovered that Monique's computer has an function of 'buy clothes' which actually works (which I didn't realize because I've never used it before) and that it's just like shopping on Amazon, without all the algorithms that the site and Google uses!

And for the record, here is a definition of an algorithm from this site:

Tech Target

https://www.techtarget.com/whatis/definition/algorithm

Quote:
An algorithm is a procedure used for solving a problem or performing a computation. Algorithms act as an exact list of instructions that conduct specified actions step by step in either hardware- or software-based routines.


If this doesn't satisfy everyone's quibbles, take it up with them!

kestrellyn 16th Dec 2024 6:12 AM

I mean, I am a professional software engineer, have been for the last nine years. Nothing "semi" or "former" about it. BHAVs are functions, what's important for understanding them is understanding what a function is, not what an algorithm is. I can write an algorithm on a napkin, but that algorithm isn't going to do anything or run or change how your sims game works, because it's just a napkin with some writing on it. Similarly, BHAVs and other functions don't have to involve an algorithm at all, some BHAVs are just no-ops and don't do anything.

simsample 16th Dec 2024 12:39 PM

1 Attachment(s)
...........................................................


topp 16th Dec 2024 1:05 PM

Quote: Originally posted by iforgot
Topp if you have further questions or need further information, please direct them to kestrellyn.
Uuuhhh..... in the meantime, I have changed my major, guys, but thanks

(I'm still math. Only now, I'm taking on more Psychology and Didactics classes, so that I could be a math teacher too, if need be, with where the IT sector is going these days... As a mathematician, though, I like indulging in some philosophy every now and then and I find this discussion fascinating, but I see others are bored. But thanks for all the explanations, guys! Once I find time, I'll first find inspiration on what to try to make, and then I'll return with some more questions.)

iforgot 16th Dec 2024 1:49 PM

Quote: Originally posted by simsample
...........................................................


Well, at least you haven't started swinging your baseball bat yet.

Quote: Originally posted by topp
Uuuhhh..... in the meantime, I have changed my major, guys, but thanks

(I'm still math. Only now, I'm taking on more Psychology and Didactics classes, so that I could be a math teacher too, if need be, with where the IT sector is going these days... As a mathematician, though, I like indulging in some philosophy every now and then and I find this discussion fascinating, but I see others are bored. But thanks for all the explanations, guys! Once I find time, I'll first find inspiration on what to try to make, and then I'll return with some more questions.)

No worries. Anyhow, I think it's time it all moved on.

simsample 16th Dec 2024 2:03 PM

Quote: Originally posted by topp
I like indulging in some philosophy every now and then and I find this discussion fascinating, but I see others are bored.

I'm not really bored, I just like teasing @kestrellyn because she is a fiend for accuracy (which is not a bad thing). I hope she takes it with the joky intent I have, and doesn't hate me too much!

I find these conversations fascinating too...

Charity 16th Dec 2024 2:05 PM

Quote: Originally posted by kestrellyn
[code]Object id: 197 name: N001_User00011 - Don Stack size: 13 Error: Reference to tree tree parameter when no parameter exists. Iterations: 188 Frame 12: Stack Object id: 14 Node: 13 Tree: id 4110 name 'Phone - Invite Sim Over' version -32736
Don, quit breaking the phones in your quest for more hook ups!
Quote: Originally posted by topp
Uuuhhh..... in the meantime, I have changed my major, guys, but thanks
I read that as you changed your major because you looked at this discussion and thought 'hell no'. XD
Quote: Originally posted by simsample
...........................................................
I know that man and yet I cannot remember his name!

iforgot 16th Dec 2024 2:20 PM

Quote: Originally posted by Charity
I know that man and yet I cannot remember his name!

It's Adrian Edmondson, playing the character Vyvyan in a TV series "The Young Ones" (Who are not so young anymore, I might add. )

Charity 16th Dec 2024 3:18 PM

Quote: Originally posted by iforgot
It's Adrian Edmondson, playing the character Vyvyan in a TV series "The Young Ones" (Who are not so young anymore, I might add. )


Of course it is! Thanks!

Charity 16th Dec 2024 6:17 PM

Quote: Originally posted by jonasn
Those doors are as impassable to a female cleaner or lot owner, as the great firewall of china, even if there is broken sink flooding everything. I noticed that female bathrooms sometimes have a sofa for sitting, while a male bathroom sometimes doesn't even have a toilet for a number two.


I would not like to see the urinals of a toilet with no cubicles for number 2! Do bathrooms on an owned lot not even allow female employees in to clean?

Also, the talk about algorithms got me thinking. What is the 'algorithm' that they talk about for places like YouTube?

jonasn 16th Dec 2024 8:00 PM

I'm not entirely sure because I've not played unmodded for many years. I think they can't pass through those doors. I made it so that employees or owner can enter if the store is closed. You could of course solve it in different ways like building a locked service door. But I find it wrong when NPCs can enter any time they please.

I think the word algorithm on random content selectors are used with a new meaning. If I were to make a dictionary, that is how I would put it. Most people can't understand the program because it is held private and far too complex, so they assign a mathematics-sounding word to it to describe it. It probably incorporates multiple traditional algirithms.

Bulbizarre 16th Dec 2024 8:21 PM

Quote: Originally posted by Charity
I would not like to see the urinals of a toilet with no cubicles for number 2! Do bathrooms on an owned lot not even allow female employees in to clean?


Quote: Originally posted by jonasn
I'm not entirely sure because I've not played unmodded for many years. I think they can't pass through those doors. I made it so that employees or owner can enter if the store is closed. You could of course solve it in different ways like building a locked service door. But I find it wrong when NPCs can enter any time they please.


The lot owner can't enter an opposite-gender door. I usually stick to unisex bathrooms these days, but in the past I've used moveobjects to move the Sim into the room or swapped the doors.

iforgot 16th Dec 2024 8:45 PM

Quote: Originally posted by Bulbizarre
The lot owner can't enter an opposite-gender door. I usually stick to unisex bathrooms these days, but in the past I've used moveobjects to move the Sim into the room or swapped the doors.

I think jonasn meant that they modified the door to add that functionality, not that it's the default behaviour, at least that's how I read it with the "I made it so" part.

jonasn 16th Dec 2024 9:02 PM

Yes, Iforgot. I usually try to build single occupancy bathrooms. They take a bit more space but sidestep a few problems that would need mods, such as selecting the right one by hand or people blocking the stall. They also feel more natural like at home. I got a bit annoyed with needing to remember which gender I was at the time, that I created a push to go to another bathroom if can't reach mod.


All times are GMT +1. The time now is 1:51 PM.
Page 474 of 474

Powered by: vBulletin Version 3.0.14 · Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.