/robowaifu/ - DIY Robot Wives

Advancing robotics to a point where anime catgrill meidos in tiny miniskirts are a reality.

Build Back Better

Sorry for the delays in the BBB plan. An update will be issued in the thread soon in late August. -r

Max message length: 6144

Drag files to upload or
click here to select them

Maximum 5 files / Maximum size: 20.00 MB

More

(used to delete files and postings)


“The road to success is dotted with many tempting parking places.” -t. Anonymous


C++ Learning Classroom Chobitsu Board owner 02/11/2023 (Sat) 02:56:07 No.19777
Keep your eyes on the prize edition --- Notice: I'm going to have to put a hiatus on this project until at least this Summertime 2024 (probably later). A) There seems to be only a little interest in it right now by anons. B) Right now in my life I have too much else on my plate that needs attention. C) In the meantime, whenever I'm here I'll still be happy to answer any questions anons have for the first 11 classes so far, or for anything in the textbook thread also. I hope to be back with this later, Anons. Cheers. --- • v231125 week-thir*****, lecture: semester-end catchup (N/A) - this week's reading assignments: N/A - reading review: N/A - reading preview: PPP2 ch12 - this week's assignments: (N/A) --- So, we're done with the STL semester, this is just a decompress week to wrap up any questions you might have left/turn in your work catchup. We'll take a break until sometime in the new year, where we'll pick back up with creating C++ GUIs using the FLTK library. Merry Christmas season Anons, please enjoy the break. --- • Our classroom's textbook thread is here : (>>18749) - you'll find a link in that OP to an archive of all the code examples therein, for your local study • This course material is primarily derived from Bjarne Stroustrup's college freshman textbook Programming -- Principles and Practice Using C++, 2e (aka, PPP2) https://www.stroustrup.com/programming.html - please obtain a copy of that book for yourself, as you'll need it to complete this course successfully --- >note: if you see the thread pinned, it (should) mean we're nearby to help, so ask away! --- • BTW, we'd like to get some feedback from the class participants about this C++ programming class. Specifically, I have a few questions and I seek ideas & advice from Anons how to approach these needs: - How to best run our classroom using (only) this IB? - How to give out exercises & assignments, & receive solutions? - How to assign grades? - How to manage the asynchronous nature of IB communications, student-to-instructor (and vice versa)? - How to utilize the textbook thread well, since it (mostly) contains already-worked solutions? - How to do tests? - How to manage a final group project together? What should that project be in fact? - Any other advice or suggestions you think would be helpful. Please post your recommendations for these topics ITT Anon, thanks! :^) --- >unless otherwise-noted, everything ITT is MIT (Expat) licensed >copyright 2023-2024
Edited last time by Chobitsu on 02/05/2024 (Mon) 12:10:03.
>spare reserve
Edited last time by Chobitsu on 05/05/2023 (Fri) 07:18:45.
• brief Q&A about the class : >What level are you starting at? Beginner (but serious beginner) level. Lots of reading involved + homework code assignments geared for each stage. Classes are once per week, held during the weekends. >Is this a one-shot thing where we'll have a project from zero to finish in a day, or the beginning of a long-running (semester-long?) class? Probably four phases spanning roughly a year's time. This first phase is planned for about 7 weeks' duration. Each new phase will build on the last one, in order. >What's the end goal? To enable an elite cadre of superior men, rigorously molded into capable systems developers & engineering craftsmen, forged together into a crack team of software savants, all pioneering the way forward for humanity, to create The SOTA in opensauce robowaifu systems... what else!? :DDD - Oh, and also to help prepare those men to land high-paying jobs developing software using C++ & C afterwards. :^) >What's required to participate? (Development environment, libraries, OS, etc.) That's up to you. Obviously a C++ compiler + text editor at a minimum. I'd suggest you use what I personally use all day erry day: https://gitlab.com/*****pit/jucipp - Everything you need on your system for good success with this classroom will be included during that installation process. Also, the free online compiler site Coliru will often be used during the classroom. https://coliru.stacked-crooked.com/ We'll be focusing strictly on Unix', since that is what robowaifus are going to be built upon, ultimately. - However, we'll make an effort to accomodate others who use W*ndows. :^) >What's the time zone for most active participation? Well that's TBD ATM, but basically anytime during the weekends is good. In fact really anytime at all is OK, but the classes are geared around plans for a new one each Saturday during any given 'semester'. Instructor responses are likely to be quicker on Saturdays & the thread will stay pinned on that day whenever we're near-to-hand for the students. • mini C++ classroom FAQ : • Help! How do I build C++ software? Get yourself a text editor, create a file named 'main.*****p', and copypaste this text into it: #include <iostream> int main() { std::cout << "Hello World!\n"; } Open a terminal in the same directory and copypaste this into it: g++ main.*****p && ./a.out Yes, it's really that simple (assuming Linux or macOS). • Why are we learning C++? Why not C? Good question! Actually the plan is that we will be learning C later on during the course. Here's a few reasons for this ordering of things: (>>22161). Additionally : - C++ is the language that most-directly allows you to express ideas from the largest number of application areas. - C++ is the most widely-used language in engineering areas. - Both C++ & C are ISO (international) standards. This means that regardless of most anything else, they will both still work as published 50 years from now! For opensauce robowaifu development this is a very good thing of course. :^) • Why use std::vectors? Why not just use plain C-arrays, everyone knows C-arrays are better?! Heh, define 'better'. (>>25518, ...) • recommended extra-curricular reading : 1. The Timeless Way of Building by Christopher Alexander Oxford University Press (1979) The literal single-best Architectural book in software! :^)
Edited last time by Chobitsu on 10/01/2023 (Sun) 05:29:29.
>spare reserve
Edited last time by Chobitsu on 05/05/2023 (Fri) 14:56:56.
The official /robowaifu/ guide to setting up a C++ development environment starts here!! The compiler The first thing you need for C++ programming is a C++ compiler. It's the program that takes your code and converts it into a program you can execute through a series of steps like linkage and whatnot (you don't need to care about all that for now, I think) On *nix OSs, the 2 most popular choices are gcc and clang. Personally, I prefer clang as its error messages tend to be more understandable (not really sure if that's even true, but I've seen most people online say that so I guess I'm just repeating that back like a true ignorant person -_-), but gcc is probably already installed on your system (try it! gcc -v should give you something like gcc version 12.2.0 (GCC) along with a lot of other data). So that's pretty much everything but windows covered... For Windows afaik there's essentially 2 choices. One is mingw and the other is Microsoft Visual Studio and its special compiler that comes with it (MSVC). MSVC is definitely the more popular choice in the industry, but mingw is still used with most other IDEs (I think?). Anyway, that brings us to the next part... The IDE IDE stands for Integrated Development Environment. It's first and foremost the program where you write code, but it should also help with other things like debugging and version control and whatnot. Specifically for these classes, you probably don't need anything special, but just so you know: The 2 hot IDEs with C++ professionals on the market right now are Microsoft's Visual Studio and JetBrains' CLion. Both are huge programs with lots and lots of useful features. For something more simple (and lighter on your resources!) the general recommendation is Visual Studio Code (not to be mixed up with just Visual Studio which is that other IDE I mentioned above). There's also Code::Blocks, an IDE already set up for C++ programming that makes it all super easy (just install it and you're set). I remember using it when I was learning and it's used in lots of university classes too around where I live (somewhere in Europe). Some other options are CodeLite, Gnome Builder and there's probably a couple more, but I think that's enough and your head might already be spinning from all these options to choose from. Oh also there's online IDEs you can use, so you don't have to install or set up anything, just write code in a web application and it just werks. The most well-known Web IDE is Repl.it (or at least it's the only one I've used, I'm not really sure about what the options are) Other stuff As that one slide in this lecture said, style matters(!!) One thing to do with style in programming is how your code will be formatted (spaces, newlines, etc.). The usual formatter used for C++ is clang-format. It allows you to choose from a couple presets for code style (you can find them all online, I think Google's C++ style guide is the default option) and you can also define your own rules. The config I usually use is: SortIncludes: false IndentWidth: 4 TabWidth: 4 ColumnLimit: 100 This disables my #include declarations getting sorted alphabetically or whatever (some styles require that). I work with some stuff where that can lead to bugs so it's really annoying. It also sets my indent width to 4 spaces (you'll see what this means later on once we start writing more complex programs) and makes my code have a max width of 100 characters (code that takes up too much screen width can be hard to read...) You usually place your config in a file called .clang-format next to your files and the IDE uses it as input for when it formats your code. Another important thing is version control. It's probably too early to start talking about this, but look into git and GitHub if you're interested.
Edited last time by Chobitsu on 05/05/2023 (Fri) 23:07:16.
>spare reserve
>Im a uni professor, electrical engineering as a background with a Msc and a PhD in robotics so this is my thread. >Depends on the rype of robot that you want to build. if you want an humanoid and want to avoid all dynamics you could use big square foots and mantain the center of mass as low as possible. The robotics in that case can be just an arduino and servos but youll only make something small, like a desk-robot. If you want to make a mobile robot with hands, something like a Packbot its even simpler as the tracks will give you the stability needed. >However, if you want to make the robot 'smart' and not something that is actually a RC-robot, you can use openCV or MsCOCO for vision, and pre-construct routines fot the system which youll need to use some more 'pro'software. I use MATLAB mostly for robot control, and for simulations i use coppeliaSim so ill start there. That's a post from 4chan
>>19830 >That's a post from 4chan It's a good one Anon. Academicians tend to live in so-called Ivory Towers, so take their perspectives with a big grain of salt, would be my advice. Now, if you can get the technical information (including full sauce-bases please) from Boston Dynamics' Atlas, then that would be most welcome here haha. Even the TeslaBot early work would be fine. :^)
>>19831 There's nothing wrong with the ivory towers I think. The streets and the hussle are overrated. Like a prostitute knows more about the economy than say an economist. Some people think that way lol.
>>19832 Lmao. Fair enough, just don't buy into their nuspeak until you've actually had to optimize a few dozen runtime algorithms, systemically, rigorously, yourself, personally. Then you can properly judge with some degree of practical accuracy whether their ideas have any real merit to them, or are simply ideologue-driven fabrications that can't handle real life out on 'the streets' as you put it (say, 100's of thousands of live, interconnected, 6-sigma phone switches for one example). They don't run MATLAB out on these boxes, BTW, but rather OG C++. Some of them are truly brilliant, say the father of the Internet, Al ***** Vint Cerf, or the (primary) inventor of modern chip fab design approaches (among several other accomplishments), Carver Mead. But for every one of these stellar academic men, there are 50'000+ pure seat-warmer tokens, I'd estimate. Cheers.
Edited last time by Chobitsu on 05/05/2023 (Fri) 15:01:51.
>>19832 > Like a prostitute knows more about the economy than say an economist I think you give economists too much credit. People close to the customers see a recession earlier than many institutions.
Well either way I don't see what C++ has to do with making robots No offense.. Python would be more appropriate ironically. Opencv is python, pytorch is python, a lot of this stuff is python... you could get a phone, put some opencv script on it and connect it to a robot hand and make the hand gives you a thumbs or a thumbs down depending on what you show it and stuff I think.
>>19838 Board owner is a C++ enthusiast and everyone here picks his own preferred tools anyways. Python is used more in AI nowadays, but also robotics is more than AI. Low level languages can be quite useful to make things fast. Python in AI might also get replaced by Swift in some time, we'll see. It might also not be used after the research phase, when it comes to build something more optimized. Of course we have a whole thread on this topic programming languages here >>128 discussing other languages, with the latest overview here >>13955 (there was some trolling or flame war, making that necessary, but seemingly got deleted). I think this here is for more long term benefits, help training the future engineers. If you just want to build something fast then yes, you would learn the basics of Python and go with some framework.
>>19777 Watching this thread with bated breath. Even though I've done a good bit of C, it's always good to learn how to truly engineer the kind of systems we'll need, instead of just stitching together Python libraries (though that'll be helpful too.) Learning together with like minded people will hopefully help get too-busy (read: lazy) people like me off our asses and contribute.
Open file (1.07 MB eop.pdf)
>>20720 Thanks Anon! Your experience with C should be somewhat helpful to you. Remember that time you were writing what was functionally your first string 'class'? Or when you decided to make dealing with vectors arrays easier? :^) C++ represents a fairly expansive attempt at doing just the kinds of things that C already does very well, but also offering an effective, mathematically-rigorous approach for layering abstractions on top of it all too (file-related [1]). And this enhancement is primarily cost-free as well if you don't count having to learn the language's syntax haha :^). It also offers many other interesting characteristics as a programming language. And 'wall-clock performance' is a critical aspect of the language's design & evolution from it's very inception (approaching 50 years ago now). It has remained thus to this day -- even more so in fact. That, in combination with it's several other benefits, sets C++ singularly apart for our robowaifu systems-development efforts here. C will remain the top dog for custom code inside of microcontrollers, sensors, and other smol devices onboard robowaifus (so don't lay those skills aside either!) I welcome you & every other anon here in pointing out each time/anytime, everything that's not clear within this 'classroom' Anon. I'll try to do my level best at patching it up, and that's how all of us together will improve our learning classes for the future Robowaifu Technicians to come! Cheers Anon, in the end it's gonna be epin! :^) 1. https://elementsofprogramming.com/
Edited last time by Chobitsu on 05/05/2023 (Fri) 15:02:26.
>>19838 For one, robots are hard real time, and you can't do real time in Python. If you fail a deadline in an audio system, you get skips and pops. If you fail a deadline in your robowaifu, she pauses while gravity continues and soon she's squirming on the ground. I'm sure robotics has a million such situations and I have no experience with robotics. And Python will be very vulnerable to abrupt pauses at the very least due to garbage collection. Additionally, VM/interpreted languages often make it impossible to say for certain that you cleared some memory. This is important when you're handling cryptographic secrets, passwords, and the like. Letting this information linger in memory after you're done with it is a source of security vulnerabilities. Also, robotics is at the cutting edge of technology. There is no slack. Robot-portable batteries last too little, processors produce too much heat, consume too much power, and are too slow; memory and storage are at a premium, and so on. There are no spare resources to invest into using an inefficient language. t. C++ hater.
>>20852 Nice post Nagisa, thanks! Great, succint introduction to the most readily-apparent issue of hard realtime in bipedal robotics for the beginner. I intend to address all the needs for programming I can think of during the classes and that certainly includes hard realtime requirements. As you might imagine every little thing is going to have to be audited extensively, and wall-clock not the least of which. >t. C++ hater. Haha, trust me I understand. It's simply our single best bet for success today. Hopefully Anon will help us all get around it's limitations! Cheers. :^)
I don't know if anyone else is following this but I am. Hopefully this C++ will not give me a brain hemorrhage. :)
>>21263 I've added a book for you (and every other anon ITT) to read while you're waiting for class to start, Grommet. (>>19779) When you master the Zen of building that this treasureful book contains, then you'll understand The Timeless Way. Which will in turn serve you very well while learning both C++, and all the truly deep aspects of robowaifu systems development & engineering. Cheers. :^)
Edited last time by Chobitsu on 05/05/2023 (Fri) 15:02:48.
>>19779 >The Timeless Way of Building by Christopher Alexander I think I've read that. I know I've at least browsed it. I've read so many books that it's hard to remember what I have and haven't read. Serious book worm. If you want to know the most radical, cheap, longest lasting way to build a house I've come up with it. I read a book many, many years ago called "Ceramic Housing and Earth Architecture". A house built of ceramics WOW! This idea totally obsessed me. https://en.wikipedia.org/wiki/Ceramic_houses https://www.dirtcheapbuilder.com/Home_Building/Ceramic_Houses.htm There's some problems with his approach, namely the difficulty of firing full thickness adobe, but I finally found a solution to this. Thought about writing a book but...haven't.
Edited last time by Chobitsu on 05/05/2023 (Fri) 14:56:28.
>>21332 The book is useful to help with the Zen of building (of all kinds); but I'm not recommending it to everyone b/c of houses heh, but rather robowaifus. What we're doing here will dwarf the tallest skysc*****r in complexities in the end after all. >tl;dr Read it (with robowaifu systems in mind), you'll thank me. :^) >Thought about writing a book but...haven't. No time like today bro! :^)
Alright so for those of you that would like to venture into learning by making a text based game here is a little challenge. Make it so the player loses 10 HP https://tpcg.io/_XQFHH7 Bonus points if you add more stuff to it
Open file (18.02 KB 640x360 images (11).jpeg)
>>21459 Nice you got it bros. Now make the rest of the game.
>>21464 >*dons sensei cap* >*harumphs politely* Lol No U! :^) AMA I'll help you with everything Anon.
>>19777 Could set up a Matrix channel for it. Having clear expectations for response times will be important. Without one though it would be good to let each other know when a response is read and you're replying if it's going to take a while. Another option could be to write a script to show a desktop notification whenever there's a new reply to the thread. As for assignments you could provide a list of exercises and let anons work on them at their own pace starting from wherever they're comfortable, and then reveal more as someone progresses. Feedback on something self-created will be far more valuable than a dumb test, and you could include references to the textbook thread. For practice to see if I remember how to compile C++ I made a Linux desktop notification: // notify.*****p // LIB="glib-2.0 gdk-pixbuf-2.0 gobject-2.0 libnotify" && g++ `pkg-config --cflags $LIB` -o notify notify.*****p `pkg-config --libs $LIB` #include <libnotify/notify.h> int main(int argc, char *argv[]) { notify_init("/robowaifu/"); NotifyNotification *notification; notification = notify_notification_new("Just Like Make Robowaifu", "Your robowaifu works perfectly.", NULL); notify_notification_show(notification, NULL); g_object_unref(G_OBJECT(notification)); notify_uninit(); return 0; } No idea how to connect it to the net and parse JSON though. I would like to learn about that during classes so I can parse yuge amounts of data fast.
>>22053 Thanks for the advice Anon! I'll give consideration to your suggestion. BTW, if I use your idea, then connecting & parsing JSON is a problem we've already for Pageone, et al (>>14409). I'll be sure to post a working solution to do it together as one system here on /robowaifu/ if we create that. Cheers! :^)
>>22053 BTW, with glib 2.7-ish, this does the trick: g++ `pkg-config --cflags --libs libnotify` notify.*****p -o notify && ./notify >works on my box(tm)
Edited last time by Chobitsu on 05/05/2023 (Fri) 15:03:14.
>How to best run our classroom using (only) this IB? I don't think that's an option. I think we are going to have to use matrix or discord. -How to give out exercises & assignments, & receive solutions? Give out the assignment first then post the solution a week later. This way everyone has plenty of time to work on the project. -How to assign grades? We should grade each others' assignments. This will force anons to review they learned and it will ensure a more honest grading system. -How to manage the asynchronous nature of IB communications, student-to-instructor (and vice versa)? This is why I think we will have to use matrix. -How to utilize the textbook thread well, since it (mostly) contains already-worked solutions? Post a separate thread without the worked solutions if you can. -How to do tests? Tests are going to have to be done on the honor system. No one is going to want to do a proctored exam. -How to manage a final group project together? What should that project be in fact? The project needs to be something that can be split into different parts. Not really relevant to robowaifus, but maybe we could build a network with packet radios. Such a project could be easily split into parts and would teach us a lot about programming. Packet radios are also *****ing cool. -Any other adivce or suggestions you think would be helpful. We should use problems from old C++ certification exams as supplementary material. People would be more likely to commit to this if it could help their employment prospects. (Big reason I'm interested in learning.)
>>22096 Thank you for your excellent response Ribose. I'll plan to give you a better reply later today, but I can, I think, reply to your first point now. >I think we are going to have to use matrix Probably not, but I won't discount it off-hand. Unfortunately, I don't have time to even explore the concept thoroughly enough to make an informed analysis before class starts. >or discord. Lol. Definitely not! :^) Again, I'll go over your points soon. Cheers.
>>22096 My apologies for the delay in getting back to you Ribose. >-How to give out exercises & assignments, & receive solutions? >Give out the assignment first then post the solution a week later. This way everyone has plenty of time to work on the project. One of the things we're after here is long-term usefulness of the class. In other words, anons who discover /robowaifu/ 1 year from today, and become convinced they want to learn to program robowaifu systems software too (not just to script her behaviors at home after the fact) hopefully can experience similar benefits just as well as all of us starting out here in a couple weeks. I'm still not sure if there's a better solution beyond yours, but I hope so. Maybe slightly-customized assignments or similar? >-How to assign grades? >We should grade each others' assignments. This will force anons to review they learned and it will ensure a more honest grading system. That is a really good idea Anon! I'd like to see us do so. Have any suggestions how we can do it ITT? BTW, I may say that I believe I'll take this anon's advice (>>22053) and try some kind of simple 'ClassWatcher' software that we can all use to track any thread changes quickly (eg, when an anon turns in some work, etc.) Perhaps the ability to grade each other's work can somehow be combined with this feature? I'm willing to discuss GUI or other enhancements for what is otherwise roughly meant as a simple standalone thread watcher. >-How to manage the asynchronous nature of IB communications, student-to-instructor (and vice versa)? >This is why I think we will have to use matrix. No fundamental arguments from me at this stage about this with this one major caveat: that we can do so in a way that ensures that every single communication between us all that takes place there is replicated back here in some convenient fashion. If we can devise a solution that deals with the captcha here on the board effectively, then I'd be willing to investigate your suggestion as a real possibility later. However as mentioned before, Matrix isn't really a reasonable option before the class actually gets started. >-How to utilize the textbook thread well, since it (mostly) contains already-worked solutions? >Post a separate thread without the worked solutions if you can. You may not grasp the amount of manual labor involved here. I took me weeks of effort to get to this stage with the textbook thread. And honestly, my initial question may have been short-sighted in the first place. Since the point of the textbook is to provide many concrete examples of real programming ideas for anons to play around with, its already serving it's purpose. The class exercises, etc. will be separate from those examples in the textbook thread (though often directly-related). I think the real question I may have been trying to formulate is "How do we provide exercises & answers, in a way that won't spoil the process for others later?" And I think my answer is probably something along the lines of "Pick one or two non-worked problems." So, say we provide 10-15 exercises and Anon chooses one to work on. It's marked off the list of available options, and everyone else who follows-on chooses a different one from the remaining selections. At least that's the basic idea ATM. Please share if you can think of a better one, anons. >-How to do tests? >Tests are going to have to be done on the honor system. No one is going to want to do a proctored exam. Fair enough. Probably not a better solution for it ATM IMO. >-How to manage a final group project together? What should that project be in fact? >The project needs to be something that can be split into different parts. Not really relevant to robowaifus, but maybe we could build a network with packet radios. Such a project could be easily split into parts and would teach us a lot about programming. Packet radios are also *****ing cool. Indeed they are, and this type thing would definitely have practical applications for Anon & his robowaifus in the real world. However, we'd each need to have some kind of physical tranceiver hardware systems to create working examples at home. I don't yet, and I suspect that most other anons don't as well. But if you or any other anons here want to pursue the idea you should go for it! I'll help out as I may. I think we'll need to keep looking for a final project Anon, but this is a great real-world project idea for the board to think about working on later as an accessory component subsystem of real robowaifu kits. >-Any other adivce or suggestions you think would be helpful. >We should use problems from old C++ certification exams as supplementary material. People would be more likely to commit to this if it could help their employment prospects. >(Big reason I'm interested in learning.) Excellent. One of the side-agendas for us here is to enable any anons who complete this course successfully to be in a good position to go on into embedded or systems programming employment (along with some further studies beyond these classes). With """University""" mills churning out mounds of nuLang duJour drones, and with the general GH agendas to dumb things down to the LCDs of society, there is less & less a percentage of competent men available in the West who can program intensive systems software today. This puts anons proficient in C++ systems development at a very distinct advantage in the high-end technical job markets for such (automotive, robotics, or aerospace embedded software, say). And one thing's for certain: any Anon who successfully builds, then programs his own robowaifu with C & C++, understanding exactly what he's doing and why, should be able to go straight into a senior technical staff position in any major first world city, pulling down US$ 6 figures yearly; easily, all things being equal. So, if you can find the exam questions you'd like us to use during this class, then by all means please provide them here. Thanks Ribose!
Edited last time by Chobitsu on 05/05/2023 (Fri) 15:03:36.
New .clang-format file for the code. Save into the base code directory as '.clang-format' (don't forget the dot): https://anonfiles.com/Eec6d8o6z3/_clang_format Here's a Bash command to recursively format all the .h & .*****p files once the new file is in place: find . -type f -name '*.h' -o -name '*.hpp' -o -name '*.cuh' -o -name '*.c' -o -name '*.*****p' -o -name '*.cc' | xargs clang-format -i >=== -patch rcrsv fmt cmd
Edited last time by Chobitsu on 10/15/2024 (Tue) 17:30:09.
btw will these classes be for the absolute beginner? All I have is some Python experience from a long time ago, other than that, I really don't know anything about programming.
>>22146 It's intended for absolute beginners, actually. I'm very keen to bring every anon who's serious about learning to build robowaifus from scratch up to speed as quickly as possible for the systems programming language C++ (and then C, once you have enough understanding of the machine under your belt).
Edited last time by Chobitsu on 05/05/2023 (Fri) 15:04:10.
>>22147 C is likely easier to learn fully than C++, since it is simpler. C++ was originally called "C with Classes" and was a superset of C. t. familiar with C but not C++
>>22160 Yes, I'm well-aware of the history of both languages. I actually 'learned' C before I 'learned' C++. In my personal & professional opinion -- for any non-trivial use case -- C++ is far easier to pick up initially for the complete novice than C is. The reason is the support you get from things like std::vector, std::string, std::sort, etc. That is, the C++ Standard Library (particularly it's containers & algorithms [1][2]). For anything beyond fizzbuzz, C++ smokes C as a beginner language IMO. The primary issue is that C requires mastery of very low-level concepts much earlier than the typical novice is prepared for them. Memory model & memory management being the number-one 'killers'. By staying """simple""", C is even closer to the hardware than C++ is (which is already very close). This brings the commensurate added-burden on the human developer not to screw things up. This challenge is often incredibly difficult, tedious, and error-prone for a big system written purely in C. Modern hardware is hard. C generally does little to shield the developer from all that hardware complexity (and roughly so by design). C++ is indeed more complex overall in scale as a language, but those extended aspects are primarily related to more-advanced needs that don't come right away (and generally may not be needed at all in most industries). However, only about two-dozen or so common things in C++ are what's used for about 95% of the development needs on average. And the benefits of it's efficient abstractions are priceless to a big-systems software engineer. As robowaifu systems developers we'll be pushing ASM, C, and C++ to our limits before all is said and done (but that's at least a couple years of solid study down the road for our students here). We'll use them all, but we'll be doing the vast bulk of our real-world work in C++, and for good reasons. But Python will also be there for anyone who isn't serious about the systems development side of things (in other words, not to create the robowaifu's actual control software -- but rather to write additional programs, utilities, &tc.) And indeed we'll be using it as a language of scripting frontends for robowaifus in the end as well. I hope all that made sense, Anon. Cheers. :^) --- 1. https://en.*****preference.com/w/*****p/container 2. https://en.*****preference.com/w/*****p/algorithm
Edited last time by Chobitsu on 05/05/2023 (Fri) 15:04:29.
>>22160 >>22161 well guess I'll be learning both simultaneously. I got a C programming course this upcoming semester in college
Open file (61.45 KB 600x1000 1646381863194.png)
>>22165 Neat! Good luck Anon. I'll be interested to know what your curriculum there entails, especially your final project. I'm still fishing around for one to use here on /robowaifu/. BTW, I'd suggest you have a look ahead to chapter 27 of our textbook at some point during your upcoming semester. It may help you to see more clearly the distinctions between the two languages, and to give you some good tips for interoperability. C's a great language, but it's one quite difficult to master. IMO it literally takes years if you're tackling something very complex, as we are here. C++ also takes a long time to master, but you're waay further 'down the road' for big systems development once you do. They both have their places in creating robowaifus, and we'll be using them both. Please keep us posted on your college progress Anon! Cheers. :^) --- One other thing I might add Anon. You can get well-ahead of the curve for your C classes by becoming familiar now with the other side of the *****preference site: namely, it's C reference. It contains literally the single best professional reference in the world for the C programming language -- just as it does for C++. https://en.*****preference.com/w/c
Edited last time by Chobitsu on 05/05/2023 (Fri) 15:04:50.
Open file (81.23 KB 330x300 ponko11.png)
hmm, so how much material should be covered in each class? I'd say I'm pretty experienced with C++, so I'd like to help
>>22189 >hmm, so how much material should be covered in each class? For the first phase of our courses (roughly Part I of the textbook) our intent is 6-7 weeks of class, once per weekend, covering basically two chapters per class. So ~2 chapters of PPP2 each week, for 6 weeks, with the remaining grading pickups done on week 7. >I'd say I'm pretty experienced with C++, so I'd like to help Excellent! We'll need a good TA. Remember this isn't your father's C++ (AKA we're using modern C++, not 'C-with-classes' from the mid-80's). The textbook thread has numerous examples of the kind of code we'll be learning ITT, so it's probably a good source for you to review beforehand Anon.
Edited last time by Chobitsu on 05/05/2023 (Fri) 15:22:55.
>>22191 >we're using modern C++, not 'C-with-classes' from the mid-80's nice, glad to hear it When it comes to Modern C++, I remember "Effective Modern C++" by Scott Meyers was very useful for me. I originally learnt the basics of C++ from a course which wasn't exactly modern, so that book was how I figured out what's usually done differently. It's not really fitting for a class as it's more of a manual on what to do/not to do, but it could still be nice to mention as additional reading material or something.
>>22291 >but it could still be nice to mention as additional reading material or something. Yes, it's an excellent book. And it's definitely on the 'Books to Read ITT' list. :^) It's just that ATM it's too advanced for beginners. Stroustrup's PPP2 (and especially with me to guide the process and answer every question) is much better for now. But yes, after the first phase (~7wks) of classes, we'll fill in the extracurricular resources list. By that stage I predict our 'beginners' will actually be ahead of many pros from even just 10 years ago with proper C++ usage mechanics. Everyone will be ready for more advanced stuff by then.
Edited last time by Chobitsu on 05/05/2023 (Fri) 15:26:57.
>>22291 We have a couple days to class start. I'd mentioned the idea of you volunteering as a classroom TA. Please let me know if you'd agree to taking on that role for all of us. If so, I'd recommend highly that you download the full code archive of the first chapters from our textbook thread (>>18749) and scan over all the .*****p code files there just to familiarize yourself ahead of time with where we're going as a class. Also, I expect students to format their code before submissions, so in addition to helping them with obtaining a compiler, IDE, &tc. we need to show them how to setup clang-format as well. We're having the students begin their textbook readings at chapter 01 & 02 for their week-one studies. However for us, Chs 00 & 03 are also necessary.
Edited last time by Chobitsu on 05/05/2023 (Fri) 15:28:18.
>>22053 I plan to do this and craft a little external tool for everyone to watch this thread. But it will need to be built, and we still need to go over the basic 'Hello World!' compiling for beginners first. So the plan is hopefully for next week, and we'll use that task to help students look at the Meson Build system during the process.
Edited last time by Chobitsu on 05/05/2023 (Fri) 15:29:29.
Open file (162.56 KB 720x540 Slide1.png)
Open file (169.73 KB 720x540 Slide2.png)
Open file (166.55 KB 720x540 Slide3.png)
Open file (170.11 KB 720x540 Slide4.png)
Open file (173.47 KB 720x540 Slide5.png)
Lecture 01 begins Welcome to our programming class, /robowaifu/ & frens. Feels good to finally get to today! :^) These slides were created by Bjarne Stroustrup for the freshman programming courses taught during his 9-year tenure as Professor at TAMU (in TX, USA). The students in the classes were all first-year EE, CE, & CS majors. Many (>40%) had never programmed before, yet most succeeded at it using this textbook. You can do it too Anon! Be sure to read all the slides and try to understand clearly what's being said during these lectures. We'll try to reinforce the ideas ourselves down in the post's text, and will maybe also try to put some real-world robowaifu spin on the material. And that's what we're here for, right Anon? So let's all get started... gambatte! :^) 1
Edited last time by Chobitsu on 05/12/2023 (Fri) 22:56:53.
Open file (174.13 KB 720x540 Slide6.png)
Open file (167.40 KB 720x540 Slide7.png)
Open file (171.29 KB 720x540 Slide8.png)
Open file (175.92 KB 720x540 Slide9.png)
Open file (168.00 KB 720x540 Slide10.png)
>>22359 It's important that you keep a realistic view of things early-on during this course. If you're a novice, you'll learn much and work hard, but this will just be the beginning for you on your long journey to becoming a professional developer. However, we think this will be the literal best approach for you becoming a competant developer for robowaifu systems code, so you're in the right place for all that Anon. Patience! :^) And if you're more experienced, it will still be a lot of work over the next year or so, but you probably already have a more tempered view of things to begin with. However we think you'll find plenty that's interesting enough by the end of this first phase of the course. DEFINITELY ask questions Anon (and lots of them)! Within this IB format, this is literally the only effective way for us to help you out with your programming problems. We can't 'read your mind' or your body language or facial expressions to know that you're struggling with something. So if you wonder about a question then please ask it! Also, you are all strongly encouraged to help each other out. If you believe you have the right answer to some anon's question then please help out! 2
Edited last time by Chobitsu on 05/12/2023 (Fri) 22:57:07.
Open file (169.73 KB 720x540 Slide11.png)
Open file (174.23 KB 720x540 Slide12.png)
Open file (168.63 KB 720x540 Slide13.png)
Open file (172.14 KB 720x540 Slide14.png)
Open file (170.88 KB 720x540 Slide15.png)
>>22360 C++ is an excellent programming language choice for robowaifu systems development -- and in our opinion it's literally the best overall choice in fact. As a programming language it's extremely flexible (we'll need that), and very fast (we'll need that). Millions of men already know the basics of programming with C++, which brings a potentially-large group who may decide to help us out during this grand adventure of robowaifu development. Very high-quality (+ free) compilers, tools, and 3rd-party libraries exist in abundance for the language across an unexcelled range of fields & interests. As an ISO standard, it's effectively in the public domain (as it were), and not under the control of any private institutions or organizations. Anyone who's following AI knows just how bad that can turn out to be, viz; ClosedAI OpenAI & others. In fact, not even the governments of nations can really effectively usurp the fidelity of this language -- they would both bring down the ire of the other representative nations if they even attempted it, and everyone else around the world would simply ignore their machinations and just 'route around' any attempted corruption of the language standard. This kind of circumstance is a pretty rare thing during Current Year Anon, as you're likely already aware. Both treasure this fact, and also relish it's benefits for us as longterm robowaifu developers! :^) 3
Edited last time by Chobitsu on 05/12/2023 (Fri) 22:57:20.
Open file (168.52 KB 720x540 Slide16.png)
Open file (168.55 KB 720x540 Slide17.png)
Open file (163.66 KB 720x540 Slide18.png)
Open file (146.81 KB 720x540 Slide19.png)
Open file (164.76 KB 720x540 Slide20.png)
>>22362 Please point out any discrepancies, oversights, etc., with this course Anon. While it draws heavily from Stroustrup's PPP2, it is in fact new curriculum material in that every part of it (but the slides) was touched 'by hand' in some form or fashion. There will be errors, as with any new curriculum or textbook. TIA for your help Anon! :^) Personally, I appreciate the choice of many of he photos here because in general they represent more closely what we'll be doing as robowaifu systems developers. That is, most of these are embedded uses of C++ (which is in fact the largest use of both C & C++ around the world). Most of these programs aren't running in a 'box' at your desk (or even on a smartphone). Robowaifus will be chock-full of just this kind of non-PC processors and specialized programming. --- note : Whenever there is a photograph in any of these slides (during the entire book), every picture is in some way related to C++ (such as the eminent men that laid the software foundations for robowaifu systems before us, e.g., Dennis Ritchie) or is a direct example of C++ running within/related to the pictured items (such as the fuel-injection control systems of those yuge ship engines). And most all of these images are but representatives of entire classes of systems that rely heavily on the language, not just for those particular items. >question: Which cylinder is the man standing closest to? protip: No. 1 is nearest to the ship's screws 4
Edited last time by Chobitsu on 05/12/2023 (Fri) 22:57:34.
Open file (145.69 KB 720x540 Slide21.png)
Open file (122.75 KB 720x540 Slide22.png)
Open file (166.98 KB 720x540 Slide23.png)
Open file (173.32 KB 720x540 Slide24.png)
Open file (177.57 KB 720x540 Slide25.png)
>>22363 And now we begin to get into the primary point of chapter 2, namely our 'Hello World!' program. I'd urge those who already have some familiarity with programming to re-think again about all that is going on here. Try to look at it again as a novice. And for our novices, please speak up if you don't 'get' something! Often, it may be too easy for those of us who've been at this a while to forget all the challenges that come at first; maybe hard even to remember clearly the bafflement some of this had for us back at the beginning. :^) --- BTW the Mars photo is a joke about "Martians". The rover itself has an onboard AI application written in C++. It does autonomous path-planning & navigation (to a target location sent ~25 hrs in advance by NASA's JPL Mission Control). Why 25, BTW? :^) 5
Edited last time by Chobitsu on 05/12/2023 (Fri) 22:57:49.
Open file (174.78 KB 720x540 Slide26.png)
Open file (171.92 KB 720x540 Slide27.png)
Open file (173.69 KB 720x540 Slide28.png)
Open file (162.06 KB 720x540 Slide29.png)
Open file (177.46 KB 720x540 Slide30.png)
>>22364 It's important not to get bogged down (especially during this initial timeframe) trying to understand too much. It's usually much easier to gradually grow in your understanding through repetition. All the 'boilerplate' of Hello World! is an example of that. Eventually you'll become so used to it that it's no longer puzzling, but rather familiar. Patience! :^) For now just focus on the single statment: cout << "Hello World!\n"; since that's the one that really matters in this context. --- BTW, we'll be using the compiler named 'g++' during this course. It's a powerful, sophisticated, and free development tool. IIRC RMS actually began it's development back in the day, though it's long been taken over by other men since. The build system has basically two steps in creating your program, compilation then linking. The GCC suite includes programs for doing both of these steps, along with several others. 6
Edited last time by Chobitsu on 05/12/2023 (Fri) 22:58:11.
Open file (179.33 KB 720x540 Slide31.png)
Open file (164.95 KB 720x540 Slide32.png)
>>22365 Why is programming so difficult? In our opinion it's primarily an issue with human cognition and our ability to reason clearly in the face of complexity. Robowaifus are certainly going to be very complex systems once all is said and done. This is one reason we'll often need to 'step back' and think about the bigger picture of things as we progress along in our developments here. How can multiple, independent systems can all work together to accomplish a desired outcome for instance. This takes a thoughtful, sophisticated approach to all the subtle interactions going on amongst all the 'moving' parts. This area is known as Software Architecture, and it will be absolutely vital to our success devising real robowaifus. More on that later. Well, we hope this was an enjoyable opener to our classroom here for you Anon. We'll have much more to explore here as we make our way along this path. Get ready to learn lots! Cheers. :^) Lecture 01 ends 7
Edited last time by Chobitsu on 05/12/2023 (Fri) 22:58:28.
For this week's code work, you're simply expected to have "Hello World!" building and running correctly. Ask this week for help if you need it. Lookup all the terms from chapters 01 & 02. Once you finish reading both chapters, preview chapter 03. That's it for this week Anon. Next week we'll have a lot more work, so be prepared! Cheers. :^)
Edited last time by Chobitsu on 05/12/2023 (Fri) 22:58:58.
Anon's work (>>22601): • Chapter 1 Review score: 100/perfect - Very creative answers in general Anon! You'll fit right in here on /robowaifu/ I'm sure. • Chapter 2 Review score: 95 + 2.5 = 97.5 -half mark off for #8 The linker links already-compiled object files (whether yours or a library's) together into an executable output file. Your answer indicates a slight misunderstanding of this, AFAICT. (cf #9) -quarter mark on for additional, correct information you gave (eg, #2). Very nice job Anon! I don't see your 'Hello World!' code assignment, so please turn that in too.
Edited last time by Chobitsu on 05/21/2023 (Sun) 02:44:19.
>spare reserve
Edited last time by Chobitsu on 05/05/2023 (Fri) 11:54:07.
>>22381 Heh long Bjarne is long! :^)
Open file (94.08 KB 334x301 ponko12.png)
>>22320 I didn't check on this place yesterday and now classes have already started... Anyway, I'm fine with that. I may not be able to dedicate to it too much since I'm really busy with some things irl this whole month, but I'll try. So what now? Are we just waiting for people to post something or should we make a guide for how to set up the compiler and all?
>>22385 Great! Thanks ponko-anon, that's much appreciated! :^) >So what now? Are we just waiting for people to post something or should we make a guide for how to set up the compiler and all? Yes. To both. :^) I'm working on the lecture curriculum ATM, so if you could tackle the compiler, etc., setup info for us it'd be great. We already have a spare spot reserved for your info text up near the top ITT (I'll copypasta it when you're done). Cheers Anon, glad to hear from you! :^)
Edited last time by Chobitsu on 05/05/2023 (Fri) 22:31:50.
>>22396 >I don't know... I'm just scared that there won't be much interest. I'd just give it some time and see how it goes for now Ehh, don't worry about it Anon. This is a long-haul kind of effort we're all pursuing here developing robowaifus. Once many anons have made different attempts at control systems in other ways, I believe many that may be skipping it ATM will want to pursue C++ learning then. Life-lessons go that way most times AFAICT heh. And for me personally, this class is a 'labor of love' so I'm pursuing it regardless. And we have a couple of regulars that expressed a keen interest so I expect they will put in the effort. Regardless, there needs to be a high-quality C++ beginner-to-mid learning resource (much better than the ones out there already) somewhere, and /robowaifu/ is really the perfect location, since we'll need it's benefits in the end much moreso than average. :^) Just curious what you're interest in C++ might have been before coming here Anon?
Edited last time by Chobitsu on 05/05/2023 (Fri) 23:28:10.
>>22397 >Just curious what you're interest in C++ might have been before coming here Anon? Well mostly graphics programming stuff (opengl, vulkan and all that). Before that, I made a lot of small games and simulations with raylib and SDL. And overall, I just like the language. It's a different feelinf compared to programming in something else. For example, these days I'm programming in Rust a lot more than C++ because it does some things so much better (error handling for example. I don't really care about the borrow checker since RAII in C++ is good enough, but the standardization with error handling, nullability, and overall how interfaces are designed is amazing). But programming Rust just doesn't feel as good. I'm not sure how to describe it but it's like I'm not as close to hardware as I am with C++ (to a degree that's true, with all those abstractions, but it feels weirdly limiting somehow...). So I guess that's my C++ experience. I haven't done anything special with it like using it in a job but I really like it
>>22398 Neat! Thanks. I've basically known for over a decade now that I wanted to do robowaifus and even before that just some kind of robot fren would be cool I thought. I started playing around with programming, found out both how cool it was and that I could actually do it a little then eventually wound up learning C++ and suddenly it all clicked that this was how we would be able to do a robowaifu control system. I believe it even more firmly today. I don't want us getting encumbered with products from the likes of M*crosoft, G*ogle, M*zilla, etc. Basically none of the FAGMAN are our friends, rather quite the opposite. Sticking with an ISO standard is far, far safer for us all in the long-term.
>>22399 yep, I really wouldn't like the corps to take over something like personal robots. That manga I post all the time, Ponkotsu Ponko, actually shows how this would probably end up really well: in the beginning, they made a couple realistic bots like ponko, but eventually some laws and legislations and shit happened and in present time the personal robots are all soulless boxes that look like minifridges with face displays on them. Personal bots should be something made by hobbyists for themselves, not products designed to get even more data from you and subscribe you to more services... Oh and about C++, I've always wanted to try doing some more embedded stuff, which is also something that will be required for robowaifus, but I could never get into it up to now. I recently started getting some irl opportunities related to that sort of stuff lately, so that should be interesting.
>>22400 >Ponkotsu Ponko I'd like to read that sometime. I understand she's a robowaifu? >The Globohomo taking over robots You can bet that's exactly where they want to go. Every one of the FAGMAN (and many of their orbiters) all have pilot projects going right now for humanoid robots. Heh, """wonder why""" that is? :^) >I recently started getting some irl opportunities related to that sort of stuff lately, so that should be interesting. Excellent! That will all be right up /robowaifu/'s alley!
Edited last time by Chobitsu on 05/06/2023 (Sat) 00:19:05.
Open file (57.68 KB 236x274 ponko2.png)
>>22401 >I understand she's a robowaifu? She's a personal maid robot, so pretty much a robowaifu, yeah. It's a pretty relaxing story and you get to see ponko developing her personality more and more overtime, like chii in chobits, I highly recommend it. The translations on mangadex caught up to the last chapter just a couple days ago.
Huh?? has the class already started? its may 6 here but I thought its still May 5 in Europe and USA?
Would you say I need some supplemental materials, like say this one https://www.youtube.com/watch?v=8jLOx1hD3_o or something alongside the lecture slides and the book?
>>22423 Just the original textbook PPP2, Anon. That I know I can recommend wholeheartedly. Anything else is 'iffy' at best, downright harmful at worst.
What's a good compiler?
>>22455 Clang, GCC, & VS are all, roughly-speaking, about on parity feature-wise today. The deciding factor comes down to agendas (the two FAGMAN organizaions definitely aren't our friends, while the FSF at least tries to promote opensauce ideals and literal freedom of speech), and ease of access (GCC is usually already installed on the platforms we care about). >tl;dr g++
Open file (163.36 KB 720x540 Slide1.png)
Open file (166.55 KB 720x540 Slide2.png)
Open file (166.45 KB 720x540 Slide3.png)
Open file (176.88 KB 720x540 Slide4.png)
Open file (137.61 KB 720x540 Slide5.png)
Lecture 02 begins Variables are named objects each with a specific location in the computer's memory. They also have a certain type, and this type determines what kinds of information the variable can hold, and also what kinds of operations can be performed related to it. Here, 'first_name' is a variable, and it's type is 'string' (std::string, actually). That type of object is a smart container for characters (such as those that make up words on a page). You can write in characters, read out characters, and remove characters from, using a string object. The 'cin' (std::cin, actually) is how you usually add in (so-called 'read' -in) characters to a string. For instance, if you wanted to tell your robowaifu that her name was 'Chii', somewhere inside Chii's systems a string object containing the character values 'C', 'h', 'i', 'i' would be stored (a write-to-memory operation). Perhaps that string was called 'first_name'; that object's name would be saved into a kind of general directory that the system uses for object lookups. Later, whenever she needs to recall her first name, her systems would again refer to that object's location in memory by accessing it using that object's name ( first_name ), then read out it's contents (ie, the characters "Chii") in a read-from-memory operation. --- When we write software, we store our work in source files. For C++ there are two basic types of source files: header files (.h), and code files (.*****p). Headers ( .h 's ) provide a uniform & very flexible way for the compiler to manage the functions we've defined (which are generally created inside related .*****p files). So perhaps Chii needs to see colors -- and it turns out she has a favorite one? Her software might have a header file named 'Perceive_color.h', and a matching 'Perceive_color.*****p' code file. The system might read through the header file to find, say, the declaration of a function named 'favorite_color()'. The actual function definition would be written inside the code file ( .*****p ). Both of these files would work together for the build system to use during the software build. Once generated, that system would use these function & variable declarations/definitions to help enable her to properly answer you, whenever you asked her what her favorite color was. 1
Edited last time by Chobitsu on 05/14/2023 (Sun) 00:03:13.
Open file (168.98 KB 720x540 Slide6.png)
Open file (175.63 KB 720x540 Slide7.png)
Open file (168.67 KB 720x540 Slide8.png)
Open file (171.88 KB 720x540 Slide9.png)
Open file (169.17 KB 720x540 Slide10.png)
Edited last time by Chobitsu on 05/12/2023 (Fri) 22:55:28.
Open file (170.40 KB 720x540 Slide11.png)
Open file (171.74 KB 720x540 Slide12.png)
Open file (173.91 KB 720x540 Slide13.png)
Open file (178.30 KB 720x540 Slide14.png)
Open file (170.08 KB 720x540 Slide15.png)
Edited last time by Chobitsu on 05/12/2023 (Fri) 22:55:40.
Open file (155.30 KB 720x540 Slide16.png)
Open file (157.02 KB 720x540 Slide17.png)
Open file (173.45 KB 720x540 Slide18.png)
Open file (178.27 KB 720x540 Slide19.png)
Open file (161.30 KB 720x540 Slide20.png)
Edited last time by Chobitsu on 05/12/2023 (Fri) 22:55:52.
Open file (167.23 KB 720x540 Slide21.png)
Open file (177.74 KB 720x540 Slide22.png)
Open file (171.78 KB 720x540 Slide23.png)
Open file (179.06 KB 720x540 Slide24.png)
Open file (175.60 KB 720x540 Slide25.png)
Edited last time by Chobitsu on 05/12/2023 (Fri) 22:56:08.
Open file (173.46 KB 720x540 Slide26.png)
Open file (169.71 KB 720x540 Slide27.png)
Open file (172.55 KB 720x540 Slide28.png)
Open file (164.41 KB 720x540 Slide29.png)
>>22520 Lecture 02 ends 6
Edited last time by Chobitsu on 05/12/2023 (Fri) 22:56:22.
- Remember to turn in homework for Lec 01 --- >
Edited last time by Chobitsu on 05/13/2023 (Sat) 00:50:17.
>spare reserve
>spare reserve
Chobitsu, will the lectures and problem assignments stay up even after the ciurse ends? I'd learn from them myself later. I already got a lot of my plate already, learning C, Computer Science and the fundamentals of AI by myself while also dealing with my college course. It'd be counterproductive for me to take on anymore , so I'll probably tackle C++ later on.
>>22385 A guide for setting up the compiler would be much appreciated.
>>22539 >Chobitsu, will the lectures and problem assignments stay up even after the ciurse ends? Yes, sure. After all the classes are here for you Anon. I'll be happy to continue fielding questions on the language as well. Good luck with your studies Anon! Cheers.
>>22540 He already did one, and we added his work near the top ITT. (>>19781) We'll be adding some edits to things later.
>>19779 The easiest way to get a compiler and everything else is to install build-essential package if you are on Debian or Kubuntu or Linux Mint. I recommend you use your C++ compiler (either g++ or clang++) to your advantage. Enable warnings so you can let the computer check your code: g++ -std=c++17 -Wall -Wextra -Wformat=2 -fverbose-asm -Og -ggdb -g3 program.*****p -o prog To save typing, you can put it in a build.sh file or (better) you can create a GNUmakefile (https://www.cs.colby.edu/maxwell/courses/tutorials/maketutor/ , but you also need "include guards", use a search engine.). Also, some IDEs may have a way to include the extra g++ compiler flags in the project settings but you need to consult the docs of your IDE. If you want a better build system than make, take a look at Meson. >>22423 In my experience, FreeCodeCamp is not very helpful. >>22455 I recommend you use the default (GCC, most likely) but if you are on Windows, use Clang if you can.
>>22522 Where should we be turning in our assignments? No contact info has been posted, so should I take that to mean we ought to just be dumping our files ITT?
>>22592 Thanks for the good advice Anon, I concur. I'll eventually be adding a tutorial that describes the system I use. I've already done that twice before for the board, and things haven't needed to change much other than using -std=c++20 . >>22593 Yes just turn it in ITT. Either post image capps, links to repos, or (recommended) simply do your work on Coliru. Also we've asked for advice on the matter of how to use this thread (alone) to manage the classroom. Feel free to give yours Anon, it would be welcome. Cheers.
>>22599 Got it. I just discovered the class yesterday so I'm trying to catch up ASAP. All I have right now are the review questions for Chapters 1 and 2, but after seeing your instructions I'm starting to wonder if you're even looking for those, since the uplaod methods you listed didn't include any kind of pastebin service. Oh well. This may just be a formality but here they are anyway. Ch.1: https://rentry.org/qaqaf Ch 2: https://rentry.org/gzot2 As for advice on how to use the thread; I actually think the approach you've taken is fine for now. I was going to suggest separating the lecture material from the discussion for archival purposes, but having it all mixed together like this brings an informal vibe to the proceedings that I dig. The archive should really only be a priority after we're a few threads deep anyway.
>>22601 >since the uplaod methods you listed didn't include any kind of pastebin service. Heh, I'm new at this my apologies. :^) Obviously I believe in rentry! And I should also have added ITT codeblocks, ie: struct My_foo{ }; int main() { My_foo foo; } I'll grade your work during this week and have that ready by Saturday. Thanks Anon! Don't forget your code assignment. :^)
Open file (144.59 KB 720x540 Slide1.png)
Open file (165.70 KB 720x540 Slide2.png)
Open file (156.14 KB 720x540 Slide3.png)
Open file (162.79 KB 720x540 Slide4.png)
Open file (141.00 KB 720x540 Slide5.png)
Lecture 03 begins 1
Open file (165.40 KB 720x540 Slide6.png)
Open file (158.01 KB 720x540 Slide7.png)
Open file (164.19 KB 720x540 Slide8.png)
Open file (164.76 KB 720x540 Slide9.png)
Open file (155.67 KB 720x540 Slide10.png)
Open file (157.02 KB 720x540 Slide11.png)
Open file (160.41 KB 720x540 Slide12.png)
Open file (158.80 KB 720x540 Slide13.png)
Open file (156.33 KB 720x540 Slide14.png)
Open file (157.25 KB 720x540 Slide15.png)
Open file (157.85 KB 720x540 Slide16.png)
Open file (149.25 KB 720x540 Slide17.png)
Open file (153.11 KB 720x540 Slide18.png)
Open file (159.90 KB 720x540 Slide19.png)
Open file (166.99 KB 720x540 Slide20.png)
Open file (144.48 KB 720x540 Slide21.png)
Open file (141.31 KB 720x540 Slide22.png)
Open file (167.28 KB 720x540 Slide23.png)
Open file (161.72 KB 720x540 Slide24.png)
Open file (167.12 KB 720x540 Slide25.png)
Open file (160.15 KB 720x540 Slide26.png)
Open file (169.87 KB 720x540 Slide27.png)
Open file (164.82 KB 720x540 Slide28.png)
Open file (173.22 KB 720x540 Slide29.png)
Open file (155.23 KB 720x540 Slide30.png)
Open file (143.56 KB 720x540 Slide31.png)
Open file (162.63 KB 720x540 Slide1.png)
Open file (163.80 KB 720x540 Slide2.png)
Open file (140.47 KB 720x540 Slide3.png)
Open file (167.41 KB 720x540 Slide4.png)
Open file (160.31 KB 720x540 Slide5.png)
Open file (160.12 KB 720x540 Slide6.png)
Open file (155.11 KB 720x540 Slide7.png)
Open file (149.00 KB 720x540 Slide8.png)
Open file (164.92 KB 720x540 Slide9.png)
Open file (164.36 KB 720x540 Slide10.png)
Open file (162.79 KB 720x540 Slide11.png)
Open file (163.33 KB 720x540 Slide12.png)
Open file (165.26 KB 720x540 Slide13.png)
Open file (166.49 KB 720x540 Slide14.png)
Open file (160.60 KB 720x540 Slide15.png)
Open file (166.23 KB 720x540 Slide16.png)
Open file (157.36 KB 720x540 Slide17.png)
Open file (158.34 KB 720x540 Slide18.png)
Open file (158.14 KB 720x540 Slide19.png)
Open file (156.42 KB 720x540 Slide20.png)
Open file (153.56 KB 720x540 Slide21.png)
Open file (169.19 KB 720x540 Slide22.png)
Open file (168.16 KB 720x540 Slide23.png)
Open file (162.72 KB 720x540 Slide24.png)
Open file (166.83 KB 720x540 Slide25.png)
Open file (167.79 KB 720x540 Slide26.png)
Open file (167.29 KB 720x540 Slide27.png)
Open file (172.40 KB 720x540 Slide28.png)
Open file (161.30 KB 720x540 Slide29.png)
Open file (157.37 KB 720x540 Slide30.png)
Open file (159.67 KB 720x540 Slide31.png)
Open file (157.14 KB 720x540 Slide32.png)
Open file (164.39 KB 720x540 Slide33.png)
Open file (149.51 KB 720x540 Slide34.png)
>>22652 Lecture 03 ends 13
Edited last time by Chobitsu on 05/19/2023 (Fri) 21:03:26.
>spare reserve
Edited last time by Chobitsu on 05/27/2023 (Sat) 05:15:09.
>spare reserve
>spare reserve
>>22601 OK, just to let you know you did very well on Lecture 01 Anon. (>>22370)
Open file (164.71 KB 720x540 Slide1.png)
Open file (161.11 KB 720x540 Slide2.png)
Open file (166.96 KB 720x540 Slide3.png)
Open file (126.83 KB 720x540 Slide4.png)
Open file (171.30 KB 720x540 Slide5.png)
Lecture 04 begins OK, this is a really big week for the class. We finally write a real program! :^) 1
Open file (178.02 KB 720x540 Slide6.png)
Open file (165.16 KB 720x540 Slide7.png)
Open file (175.06 KB 720x540 Slide8.png)
Open file (168.07 KB 720x540 Slide9.png)
Open file (174.17 KB 720x540 Slide10.png)
Open file (173.41 KB 720x540 Slide11.png)
Open file (174.60 KB 720x540 Slide12.png)
Open file (174.44 KB 720x540 Slide13.png)
Open file (82.63 KB 720x540 Slide14.png)
Open file (107.36 KB 720x540 Slide15.png)
Open file (112.28 KB 720x540 Slide16.png)
Open file (95.42 KB 720x540 Slide17.png)
Open file (178.84 KB 720x540 Slide18.png)
Open file (172.78 KB 720x540 Slide19.png)
Open file (172.66 KB 720x540 Slide20.png)
Open file (173.88 KB 720x540 Slide21.png)
Open file (174.11 KB 720x540 Slide22.png)
Open file (173.53 KB 720x540 Slide23.png)
Open file (171.15 KB 720x540 Slide24.png)
Open file (173.20 KB 720x540 Slide25.png)
Open file (137.94 KB 720x540 Slide26.png)
Open file (170.94 KB 720x540 Slide27.png)
Open file (171.56 KB 720x540 Slide28.png)
Open file (164.82 KB 720x540 Slide29.png)
Open file (172.00 KB 720x540 Slide30.png)
Open file (164.72 KB 720x540 Slide31.png)
Open file (168.95 KB 720x540 Slide32.png)
Open file (170.55 KB 720x540 Slide33.png)
Open file (172.46 KB 720x540 Slide34.png)
Open file (166.68 KB 720x540 Slide35.png)
Open file (169.69 KB 720x540 Slide36.png)
Open file (176.22 KB 720x540 Slide37.png)
Open file (164.58 KB 720x540 Slide38.png)
Open file (165.25 KB 720x540 Slide39.png)
Open file (164.09 KB 720x540 Slide1.png)
Open file (167.16 KB 720x540 Slide2.png)
Open file (169.60 KB 720x540 Slide3.png)
Open file (170.86 KB 720x540 Slide4.png)
Open file (177.25 KB 720x540 Slide5.png)
Open file (161.10 KB 720x540 Slide6.png)
Open file (172.34 KB 720x540 Slide7.png)
Open file (174.08 KB 720x540 Slide8.png)
Open file (176.76 KB 720x540 Slide9.png)
Open file (166.64 KB 720x540 Slide10.png)
Open file (172.14 KB 720x540 Slide11.png)
Open file (168.25 KB 720x540 Slide12.png)
Open file (169.66 KB 720x540 Slide13.png)
Open file (170.25 KB 720x540 Slide14.png)
Open file (172.59 KB 720x540 Slide15.png)
Open file (169.24 KB 720x540 Slide16.png)
Open file (172.42 KB 720x540 Slide17.png)
Open file (168.18 KB 720x540 Slide18.png)
Open file (180.54 KB 720x540 Slide19.png)
Open file (170.80 KB 720x540 Slide20.png)
Open file (168.92 KB 720x540 Slide21.png)
Open file (172.50 KB 720x540 Slide22.png)
Open file (170.03 KB 720x540 Slide23.png)
Open file (170.08 KB 720x540 Slide24.png)
Open file (171.17 KB 720x540 Slide25.png)
Open file (171.79 KB 720x540 Slide26.png)
Open file (174.19 KB 720x540 Slide27.png)
Open file (169.77 KB 720x540 Slide28.png)
Open file (171.55 KB 720x540 Slide29.png)
Open file (174.69 KB 720x540 Slide30.png)
Open file (168.23 KB 720x540 Slide31.png)
>>22801 Lecture 04 ends 14
>spare reserve
>spare reserve
>spare reserve
that's it? this is all the c++ you brainlets can write?
>>22834 Lol, this is beginner's course Anon. :^)
>>22835 tHow about everyone here makes a text based game about a robot waifu starting now and they have to finish it by the end of the month.
>>22837 Sounds like a good idea. I'll help you with it if that's what you want to do for a project Anon! :^)
>>22837 This guy speaks my language. You want to skill up to make a real-time, human-level AI some day? Drop the books and try making an 8-bit Waifugotchi first.
>>22879 >8-bit Waifugotchi Sounds fun! :^) Same offer's extended to you Anon, I'll help out with C++ information if you want to do that as a project.
>>22880 honestly I need help with freqtrade, I want to make a trading bot and im kind of stuck... that's all python though. Or you can animate the whole spritesheet, but that one is just for fun https://github.com/peteblank/yotsubee
>>22881 Haha I didn't say I'd do your work Anon, lol I have plenty of my own already! :^) But I'll honestly help you as I may if you get stuck with an honest effort. This is a classroom thread after all -- you're here to learn! Good luck with your work Anon.
Open file (164.78 KB 720x540 Slide1.png)
Open file (168.44 KB 720x540 Slide2.png)
Open file (169.46 KB 720x540 Slide3.png)
Open file (176.18 KB 720x540 Slide4.png)
Open file (170.84 KB 720x540 Slide5.png)
Lecture 05 begins 1
Edited last time by Chobitsu on 06/10/2023 (Sat) 15:33:31.
Open file (170.18 KB 720x540 Slide6.png)
Open file (168.37 KB 720x540 Slide7.png)
Open file (163.86 KB 720x540 Slide8.png)
Open file (167.77 KB 720x540 Slide9.png)
Open file (176.37 KB 720x540 Slide10.png)
Open file (173.73 KB 720x540 Slide11.png)
Open file (172.12 KB 720x540 Slide12.png)
Open file (166.07 KB 720x540 Slide13.png)
Open file (172.40 KB 720x540 Slide14.png)
Open file (131.60 KB 720x540 Slide15.png)
Open file (173.31 KB 720x540 Slide16.png)
Open file (170.47 KB 720x540 Slide17.png)
Open file (173.17 KB 720x540 Slide18.png)
Open file (173.80 KB 720x540 Slide19.png)
Open file (174.37 KB 720x540 Slide20.png)
Open file (167.61 KB 720x540 Slide21.png)
Open file (170.92 KB 720x540 Slide22.png)
Open file (174.26 KB 720x540 Slide23.png)
Open file (174.01 KB 720x540 Slide24.png)
Open file (171.84 KB 720x540 Slide25.png)
Open file (166.27 KB 720x540 Slide26.png)
Open file (171.05 KB 720x540 Slide27.png)
Open file (179.51 KB 720x540 Slide28.png)
Open file (171.87 KB 720x540 Slide29.png)
Open file (173.30 KB 720x540 Slide30.png)
Open file (167.97 KB 720x540 Slide31.png)
Open file (176.67 KB 720x540 Slide32.png)
Open file (164.09 KB 720x540 Slide33.png)
Open file (165.11 KB 720x540 Slide1.png)
Open file (163.57 KB 720x540 Slide2.png)
Open file (165.13 KB 720x540 Slide3.png)
Open file (177.22 KB 720x540 Slide4.png)
Open file (177.44 KB 720x540 Slide5.png)
Open file (170.51 KB 720x540 Slide6.png)
Open file (170.45 KB 720x540 Slide7.png)
Open file (170.95 KB 720x540 Slide8.png)
Open file (166.63 KB 720x540 Slide9.png)
Open file (170.57 KB 720x540 Slide10.png)
Open file (171.44 KB 720x540 Slide11.png)
Open file (173.44 KB 720x540 Slide12.png)
Open file (176.29 KB 720x540 Slide13.png)
Open file (171.80 KB 720x540 Slide14.png)
Open file (169.29 KB 720x540 Slide15.png)
Open file (175.32 KB 720x540 Slide16.png)
Open file (175.90 KB 720x540 Slide17.png)
Open file (171.90 KB 720x540 Slide18.png)
Open file (173.88 KB 720x540 Slide19.png)
Open file (171.43 KB 720x540 Slide20.png)
Open file (172.92 KB 720x540 Slide21.png)
Open file (166.37 KB 720x540 Slide22.png)
Open file (171.01 KB 720x540 Slide23.png)
Open file (168.03 KB 720x540 Slide24.png)
Open file (172.48 KB 720x540 Slide25.png)
Open file (168.39 KB 720x540 Slide26.png)
Open file (172.81 KB 720x540 Slide27.png)
Open file (173.22 KB 720x540 Slide28.png)
Open file (172.95 KB 720x540 Slide29.png)
Open file (172.63 KB 720x540 Slide30.png)
Open file (175.03 KB 720x540 Slide31.png)
>>22910 Lecture 05 ends 13
>spare reserve
>spare reserve
>spare reserve
>>22882 The honest effort is me animating the first row
>>22917 Well, let's see what you've managed so far (the code please) and we'll come up with a plan for it.
Open file (534.00 B 16x24 Untitled.gif)
Open file (544.00 B 16x24 Untitled2.gif)
>>22921 I posted the github page
>>22950 Oh, haha. Fair enough I suppose, thanks! But can you please just post the pertinent animation-related codeblock here ITT if you would Anon? That'll be much quicker for me, and is generally in line with the way to do things with our own textbook work. TIA. BTW, this page has information about using codeblocks correctly here. https://alogs.space/.static/pages/posting.html
>>22955 sure here it is /******************************************************************************************* * * raylib [textures] example - Sprite animation * * Example originally created with raylib 1.3, last time updated with raylib 1.3 * * Example licensed under an unmodified zlib/libpng license, which is an OSI-certified, * BSD-like license that allows static linking with closed source software * * Copyright (c) 2014-2023 Ramon Santamaria (@raysan5) * ********************************************************************************************/ #include "../include/raylib.h" #define MAX_FRAME_SPEED 15 #define MIN_FRAME_SPEED 1 //------------------------------------------------------------------------------------ // Program main entry point //------------------------------------------------------------------------------------ int main(void) { // Initialization //-------------------------------------------------------------------------------------- const int screenWidth = 800; const int screenHeight = 450; InitWindow(screenWidth, screenHeight, "raylib [texture] example - sprite anim"); // NOTE: Textures MUST be loaded after Window initialization (OpenGL context is required) Texture2D scarfy = LoadTexture("src/assets/Yotsuba_SpriteSheet.png"); // Texture loading /* fixed the path */ Vector2 position = { 350.0f, 280.0f }; Rectangle frameRec = { (float)scarfy.width, 0.0f, (float)24, (float)scarfy.height/4 }; int currentFrame = 0; int framesCounter = 0; int framesSpeed = 8; // Number of spritesheet frames shown by second SetTargetFPS(60); // Set our game to run at 60 frames-per-second //-------------------------------------------------------------------------------------- // Main game loop while (!WindowShouldClose()) // Detect window close button or ESC key { // Update //---------------------------------------------------------------------------------- framesCounter++; if (framesCounter >= (60/framesSpeed)) { framesCounter = 0; currentFrame++; if (currentFrame > 2) currentFrame = 0; frameRec.x = (float)currentFrame*(float)scarfy.width/3; } // Control frames speed if (IsKeyPressed(KEY_RIGHT)) framesSpeed++; else if (IsKeyPressed(KEY_LEFT)) framesSpeed--; if (framesSpeed > MAX_FRAME_SPEED) framesSpeed = MAX_FRAME_SPEED; else if (framesSpeed < MIN_FRAME_SPEED) framesSpeed = MIN_FRAME_SPEED; //---------------------------------------------------------------------------------- // Draw //---------------------------------------------------------------------------------- BeginDrawing(); ClearBackground(RAYWHITE); DrawTexture(scarfy, 0, 40, WHITE); DrawRectangleLines(0, 40, scarfy.width, scarfy.height, LIME); DrawRectangleLines(6 + (int)frameRec.x, 40 + (int)frameRec.y, (int)frameRec.width, (int)frameRec.height, RED); DrawText("FRAME SPEED: ", 165, 210, 10, DARKGRAY); DrawText(TextFormat("%02i FPS", framesSpeed), 575, 210, 10, DARKGRAY); DrawText("PRESS RIGHT/LEFT KEYS to CHANGE SPEED!", 290, 240, 10, DARKGRAY); for (int i = 0; i < MAX_FRAME_SPEED; i++) { if (i < framesSpeed) DrawRectangle(250 + 21*i, 205, 20, 20, RED); DrawRectangleLines(250 + 21*i, 205, 20, 20, MAROON); } DrawTextureRec(scarfy, frameRec, position, WHITE); // Draw part of the texture DrawText("(c) Scarfy sprite by Eiden Marsal", screenWidth - 200, screenHeight - 20, 10, GRAY); EndDrawing(); //---------------------------------------------------------------------------------- } // De-Initialization //-------------------------------------------------------------------------------------- UnloadTexture(scarfy); // Texture unloading CloseWindow(); // Close window and OpenGL context //-------------------------------------------------------------------------------------- return 0; }
>>22957 Got it, thanks Anon. Here's my initial suggested fix: // Main game loop while (! WindowShouldClose()) { // Detect window close button or ESC key // Update //-------------------------------------------------------------------------- framesCounter++; if (framesCounter >= (60 / framesSpeed)) { framesCounter = 0; currentFrame++; if (currentFrame > 2) currentFrame = 0; frameRec.x = (float)currentFrame * (float)scarfy.width / 3; // TODO: adjust your frameRec.y here? } Please let us know if this modification helps.
>>22958 eh thank you ill try it later
>>22958 or even simpler while (!WindowShouldClose()) { currentFrame %= 3; frameRec.x = (float)currentFrame * (float)scarfy.width / 3; usleep( 1000000/framesSpeed ); }
>>22962 that's neat and all but it didn't solve the problem. But I did it. gg. while (!WindowShouldClose()) // Detect window close button or ESC key { // Update //---------------------------------------------------------------------------------- framesCounter++; if (framesCounter >= (60/framesSpeed)) { framesCounter = 0; currentFrame++; if (currentFrame > 2) {currentFrame = 0; frameRec.y+=scarfy.height/4; if (frameRec.y >scarfy.height/4*3) { frameRec.y = 0; } } currentFrame %= 3; frameRec.x = (float)currentFrame * (float)scarfy.width / 3; }
>>22962 Yep modulo is a good choice, but I'm unsure that the sleep will help much. Thanks Anon! >>22964 Great! Full marks Anon. Now, I'd suggest you enhance your system in two ways: 1. Replace this if/else pair with tests for '+' key (plus), and '-' key (minus), instead to control the rate of animation. // Control frames speed if (IsKeyPressed(KEY_RIGHT)) framesSpeed++; else if (IsKeyPressed(KEY_LEFT)) framesSpeed--; 2. Now test all four direction keys, and this time use them to choose which row of your sprite sheet to animate (left, right, up, down) instead. Do these two steps and you'll be very close to an animated Yotsuba geimu character. Cheers. :^) >=== -prose edit
Edited last time by Chobitsu on 06/05/2023 (Mon) 16:20:36.
>>22965 >unsure that the sleep will help much because if (framesCounter >= (60 / framesSpeed)) makes no sense in a loop, framesCounter will be incremented as fast as the *****u can run its not time related the only way to do something in a timed interval is with the actual time functions not a counter, this only works because the library functions, which have proper timing/syncing, act as a bottleneck
>>22966 I see your point Anon. At the least, the call while (! WindowShouldClose()) { ... } should allow the system to do polling for the rest of the work to be done outside the gameloop (user input, file/net I/O, etc). And the draw() call bookends likely serve a similar function around that block of code. >tl;dr The Raylib library is already allowing for a responsive system. IMO, intentionally injecting a wait is probably unhelpful in general in a game (outside an intentional 'pause' system).
>>22964 >>22965 BTW, when you need to handle a lot of things that are similar, it's a more-typical (good) practice to do so inside a switch() statement. Here's my recommendation to you how to do so, just to get you pointed in the right direction Anon: >main.*****p snippet: switch (GetKeyPressed()) { case KEY_KP_ADD: { framesSpeed++; if (framesSpeed > max_frame_speed) framesSpeed = max_frame_speed; break; } case KEY_KP_SUBTRACT: { framesSpeed--; if (framesSpeed < min_frame_speed) framesSpeed = min_frame_speed; break; } // TODO: add your directional key handler code statements here... default:; // nop (for now) } You can find the enumeration of all the available keypress definitions in the include/raylib.h file, and beginning around line #520. Good luck Anon! :^) >=== -patch crosslink
Edited last time by Chobitsu on 06/07/2023 (Wed) 12:31:30.
>>22987 for simple arithmetic you wouldnt use any branching at all really key = GetKeyPressed(); framespeed += (key == KEY_KP_ADD) & (framespeed < max); framespeed -= (key == KEY_KP_SUBTRACT) & (framespeed > min);
>>22988 Good, efficient logic Anon. I like the form. But we're still in a beginner's classroom thread, so it's better to take a couple-nanosecond speed hit, for clarity of reasoning for the novice. But again, nice work! :^)
Open file (145.96 KB 720x540 Slide1.png)
Open file (162.55 KB 720x540 Slide2.png)
Open file (150.29 KB 720x540 Slide3.png)
Open file (131.73 KB 720x540 Slide4.png)
Open file (137.11 KB 720x540 Slide5.png)
Lecture 06 begins 1
Open file (136.85 KB 720x540 Slide6.png)
Open file (160.25 KB 720x540 Slide7.png)
Open file (156.54 KB 720x540 Slide8.png)
Open file (145.60 KB 720x540 Slide9.png)
Open file (132.79 KB 720x540 Slide10.png)
Open file (155.73 KB 720x540 Slide11.png)
Open file (155.46 KB 720x540 Slide12.png)
Open file (156.14 KB 720x540 Slide13.png)
Open file (162.17 KB 720x540 Slide14.png)
Open file (157.91 KB 720x540 Slide15.png)
Open file (158.38 KB 720x540 Slide16.png)
Open file (160.98 KB 720x540 Slide17.png)
Open file (171.22 KB 720x540 Slide18.png)
Open file (156.82 KB 720x540 Slide19.png)
Open file (166.87 KB 720x540 Slide20.png)
Open file (164.23 KB 720x540 Slide21.png)
Open file (158.49 KB 720x540 Slide22.png)
Open file (169.59 KB 720x540 Slide23.png)
Open file (156.42 KB 720x540 Slide24.png)
Open file (158.39 KB 720x540 Slide25.png)
Open file (158.38 KB 720x540 Slide26.png)
Open file (149.29 KB 720x540 Slide27.png)
Open file (152.85 KB 720x540 Slide28.png)
Open file (148.40 KB 720x540 Slide29.png)
Open file (162.05 KB 720x540 Slide30.png)
Open file (160.47 KB 720x540 Slide31.png)
Open file (155.50 KB 720x540 Slide32.png)
Open file (149.91 KB 720x540 Slide33.png)
Open file (164.05 KB 720x540 Slide34.png)
Open file (143.38 KB 720x540 Slide35.png)
Open file (164.09 KB 720x540 Slide1.png)
Open file (168.77 KB 720x540 Slide2.png)
Open file (171.23 KB 720x540 Slide3.png)
Open file (175.27 KB 720x540 Slide4.png)
Open file (171.59 KB 720x540 Slide5.png)
Open file (173.49 KB 720x540 Slide6.png)
Open file (173.04 KB 720x540 Slide7.png)
Open file (173.94 KB 720x540 Slide8.png)
Open file (173.29 KB 720x540 Slide9.png)
Open file (174.93 KB 720x540 Slide10.png)
Open file (176.96 KB 720x540 Slide11.png)
Open file (165.23 KB 720x540 Slide12.png)
Open file (158.14 KB 720x540 Slide13.png)
Open file (172.89 KB 720x540 Slide14.png)
Open file (153.41 KB 720x540 Slide15.png)
Open file (170.46 KB 720x540 Slide16.png)
Open file (170.23 KB 720x540 Slide17.png)
Open file (175.05 KB 720x540 Slide18.png)
Open file (166.73 KB 720x540 Slide19.png)
Open file (167.67 KB 720x540 Slide20.png)
Open file (176.54 KB 720x540 Slide21.png)
Open file (167.89 KB 720x540 Slide22.png)
Open file (172.47 KB 720x540 Slide23.png)
Open file (170.89 KB 720x540 Slide24.png)
Open file (170.51 KB 720x540 Slide25.png)
Open file (166.93 KB 720x540 Slide26.png)
Open file (165.92 KB 720x540 Slide27.png)
Open file (164.44 KB 720x540 Slide28.png)
>>23056 This ends so-called 'Phase 1' of our class (probably about like a semester). All things being equal, we'll pick back up with Phase 2 after summer, around September or so I'm sure no one yet here will mind much lol. When we do, we'll dive right into pointer/free-store -based memory management, and crafting our own STL-like data containers and algorithms, starting with Vector. Till then cheers /robowaifu/, have a great summer! :^) Lecture 06 ends 13
>spare reserve
>spare reserve
>spare reserve
shitty attempt at fireworks for the end #include <iostream> #include <chrono> #include <thread> #define XMAX 100 #define YMAX 50 using namespace std; class { private: char framebuffer[ YMAX ][ XMAX * 6 ]; public: void put( unsigned int x, unsigned int y, char p, int colour ) { if ( x >= XMAX || y >= YMAX ) return; x *= 6; y = YMAX - y; // upside down framebuffer[y][x++] = '\033'; framebuffer[y][x++] = '['; framebuffer[y][x++] = '9'; switch ( colour ) { case 0: framebuffer[y][x++] = '1'; break; case 1: framebuffer[y][x++] = '2'; break; case 2: framebuffer[y][x++] = '3'; break; case 3: framebuffer[y][x++] = '4'; break; case 4: framebuffer[y][x++] = '5'; break; case 5: framebuffer[y][x++] = '6'; break; default: framebuffer[y][x++] = '7'; break; } framebuffer[y][x++] = 'm'; framebuffer[y][x++] = p; } void clear( void ) { for ( int y=0; y<YMAX; y++ ) for ( int x=0; x<XMAX; x++ ) put( x,y, ' ', 9 ); } void draw( void ) { cout << "\033[0H" ; for ( int y=0; y<YMAX; y++ ) { for ( int x=0; x<XMAX*6; x++ ) cout << framebuffer[y][x]; cout << '|' << endl; } cout.flush(); } }Framebuffer; int main() { srand( clock() ); while ( 1 ) { int y = 1; int x = rand() % XMAX; int detonate = rand() % YMAX; int colour = rand() % 6; // woosh for ( y; y<detonate; y++ ) { Framebuffer.clear(); const char firework[5][4] = { "_A_", "| |", "|/|", "| |", "^$^" }; for ( int row=0; row<5; row++ ) for ( int col=0; col<3; col++ ) Framebuffer.put ( x+col, y+row, firework[4-row][col], colour ); if ( y%2 ) { Framebuffer.put( x+1,y,'#',colour ); Framebuffer.put( x+1,y-1,'#', colour ); Framebuffer.put( x+1,y-2,':', colour ); } else { Framebuffer.put( x+1,y,':', colour ); Framebuffer.put( x+1,y-1,'.', colour ); } Framebuffer.draw(); this_thread::sleep_for(chrono::milliseconds(50)); } // explode int size = 4; int fade = 14; const char sparkle[6] = "@*,."; for ( int i=1; i<XMAX; i++ ) { if ( (i % fade) == 0 ) Framebuffer.clear(); colour = rand() % 6; for ( int p=size; p>0; p-- ) for ( float k=0; k<1.0; k+=0.1 ) { Framebuffer.put ( x + (rand()%i - rand()%i)/4, y + (rand()%i - rand()%i)/4, sparkle[(i+p)%4], colour ); Framebuffer.put( x + (i-p)/k, y - (i+p)*k,'*', colour ); Framebuffer.put( x - (i-p)/k, y - (i+p)*k,'*', colour ); Framebuffer.put( x + (i-p)/k, y + (i+p)*k,'*', colour ); Framebuffer.put( x - (i-p)/k, y + (i+p)*k,'*', colour ); } Framebuffer.draw(); this_thread::sleep_for(chrono::milliseconds(20)); } } }
>>23083 Very nice Anon! I'll have a look into your code a bit later on. Good luck with your project. Cheers. :^)
>>23083 In your Framebuffer::draw() function, you can get a slight performance boost by not calling the std::endl operation on the std::cout iostream. This is occurring on line #52. std::endl does two separate operations: - appends a newline char '\n' to the line - flushes the std::cout iostream buffer A std::iostream flush operation in this code's context can be roughly-likened to an OpenGL buffer swap operation; you write the data to a back-buffer, then when the rendering is completed you perform a swap between the two for the new frame's display. While only a very crude analogy here, it's a reasonable one in this case. Much better to treat this operation more like a real backbuffer write operation and simply append a newline character to each line. You're already calling std::cout::flush() as the final step, and this will perform the necessary cout stream flush to console that you need to happen anyway. >tl;dr Just flush cout once, not a zillion times. Within this low-demand scenario (after all, you're literally inserting intentional waits) it's not of much consequence. But as a general coding guideline, it's usually better to choose the more-efficient route, all else being equal. Here's what I would suggest for your draw() call code instead: void draw(void) { cout << "\033[0H"; for (int y = 0; y < y_max; y++) { for (int x = 0; x < x_max * 6; x++) cout << framebuffer[y][x]; cout << '|' << '\n'; } cout.flush(); } Thanks for sharing this with us here ITT, Anon. Cheers. :^)
>>23100 nice catch, need to make sure cout isnt line buffered though otherwise '\n' triggers a flush but yeah the idea is identical to a double buffering
>>23105 >need to make sure cout isnt line buffered though otherwise '\n' triggers a flush I think that's implementation-defined, but AFAICT it does not. That's kind of the point behind streams: that they are both powerful, and flexible (cf. PPP2 chs 10 & 11 (the current lecture) for more info on C++ stream's capabilities). BTW, If you ever want to explore this perf question in greater detail, you can create a std::string using std::mem*****y()-like char array construction, utilizing a full row of your Framebuffer's private member field. This should give you somewhat better perf than the char-by-char iterating currently used by your inner loop (depending on your optimization settings & your compiler). Also BTW, you can simply bypass the iostreams library entirely, and write directly to a strided-array memory block, then dump the entire thing into the the console's screen space, curses-style. It's still a bit too early for the class to be discussing this yet, but any anon who actually does the work during the upcoming phase of the classroom (following summer) should be fully-equipped to 'fly by the seat of their pants' and deal correctly with these kinds of fast memory dump operations. Cheers. >=== -prose edit
Edited last time by Chobitsu on 06/12/2023 (Mon) 22:09:09.
>>23110 yeah its just junk code for messing around with and show some fireworks given that we completed phase1 made a nicer one #include <iostream> #include <chrono> #include <thread> #define XMAX 100 #define YMAX 50 using namespace std; class Framebuffer { private: char framebuffer[ YMAX ][ XMAX * 6 ]; public: void putpixel( unsigned int x, unsigned int y, char p, int colour ) { if ( x >= XMAX || y >= YMAX ) return; x *= 6; framebuffer[y][x++] = '\033'; framebuffer[y][x++] = '['; framebuffer[y][x++] = '9'; framebuffer[y][x++] = colour % 8 + '0' ; framebuffer[y][x++] = 'm'; framebuffer[y][x] = p; } void putobj( int posx, int posy, const char *obj, int sizex, int sizey, int colour ) { for ( int y=0; y<sizey; y++ ) for ( int x=0; x<sizex; x++ ) putpixel ( posx + x, posy - y, obj[ y*sizex + x ], colour ); } void clear( void ) { for ( int y=0; y<YMAX; y++ ) for ( int x=0; x<XMAX; x++ ) putpixel( x,y, ' ', 0 ); } void draw( void ) { cout << "\033[0H" ; for ( int y=YMAX; y>=0; y-- ) { for ( int x=0; x<XMAX*6; x++ ) cout << framebuffer[y][x]; cout << '|' << '\n'; } cout.flush(); } }Framebuffer; class firework { public: int x, y; int colour; int detonate; int state; void move( int x, int y ) { this->x += x; this->y += y; state = ( this->y >= detonate ); } void reset( void ) { y = -(rand() % YMAX); x = rand() % XMAX; detonate = YMAX/2 + rand() % YMAX/2; colour = rand(); state = 0; } }; int main() { srand( clock() ); const char firework[3*5+1] = { "_A_" \ "| |" \ "|/|" \ "| |" \ "^$^" }; const char sparkle[6] = "@*,."; const char flame[16] = ":$#... $:"; int total = 4; class firework Firework[ total ]; for ( int i=0; i<total; i++ ) Firework[ i ].reset(); while ( 1 ) { Framebuffer.clear(); for ( int i=0; i<total; i++ ) switch ( Firework[ i ].state ) { case 50: // reset Firework[ i ].reset(); break; case 0: // wooosh Framebuffer.putobj ( Firework[ i ].x, Firework[ i ].y, (const char*)firework, 3,5, Firework[ i ].colour ); for ( int k=0; k<3; k++ ) Framebuffer.putpixel ( Firework[i].x +1, Firework[i].y - 7 + k, flame[ 4*(Firework[i].y%3) + k ], Firework[i].colour ); Firework[ i ].move( 0, 1 ); break; default: // explode for ( float k=0; k<1.0; k+=0.1 ) { for ( int f=0; f<3; f++ ) Framebuffer.putpixel ( Firework[i].x + (rand()%Firework[i].state - rand()%Firework[i].state)/2, Firework[i].y + (rand()%Firework[i].state - rand()%Firework[i].state)/4, sparkle[(Firework[i].state)%4], rand() ); for ( int diry=-1; diry<=1; diry+=2 ) for ( int dirx=-1; dirx<=1; dirx+=2 ) for ( int f=0; f<5; f++ ) Framebuffer.putpixel ( Firework[i].x + dirx * ((Firework[i].state + f)/k/2), Firework[i].y + diry *((Firework[i].state + f)*k), '*', Firework[i].colour+f ); } Firework[ i ].state++; break; } Framebuffer.draw(); this_thread::sleep_for(chrono::milliseconds(30)); } }
>>23119 Neat, thanks Anon! I'll try to have a look at your code at least by final class on Saturday. Cheers.
>>23119 Very entertaining project Anon. Fun to watch. So, I'm getting a kind of 'skip back' a few lines during the animations. There could be a number of reasons for this, potentially boiling down to context switches happening with the cout object. C isn't immune from this type thing either. There are ways to deal with this in a multithreaded environment (if that indeed turned out to be the issue) but they are definitely beyond the basic scope of this introductory class. So, I'd just give you full marks, and call it a day on this one heh. :^) BTW, I'm quite pleased to see you tackling functional encapsulation within your classes. This is a great & maintainable way to establish and enforce function invariants. GG. Thanks again for all the neat work, Anon. Cheers. :^)
In answer to Anon's questions about functions and files (>>24200) : >One thing I still don't understand is how to get C++ to write data to a text file and save it. >It was functions that really threw me for a loop(heh). --- Let's start with files. And to simplify things, I'm just going to make straightforward statements about the typical use cases for files, when using C++ . You ask the operating system for access to files, whether writing to them or reading from them. When writing them, you may want to specify if you want to add information to the end of the file (append), or just overwrite everything that may already be in it (truncate). All files have a filename. - A std::ifstream is an input file (one you read in from, to your program). - A std::ofstream is an output file (one you write out to, from your program). --- You specifically mentioned an output file in your comment, so we'll begin with that as the first case. Here's example code if you want to write out the string "Hello World!" into an output textfile named 'my_file.txt' (copypaste this codeblock into a new textfile named 'write_file.*****p'): >write_file.*****p #include <fstream> using namespace std; int main() { ofstream ofs{"my_file.txt"}; ofs << "Hello World!\n"; // note the newline character at the end } Compile and run this codefile with this Bash command: g++ write_file.*****p --std=c++11 && ./a.out This will (by default) create the output file named 'my_file.txt' onto disk if it didn't exist already, then open that file in truncate mode (that is, it will wipe out anything already within the file), and then write the string into it. The output file will be closed properly when the program exits at the end of main() { } . Simple as. --- But what if instead you want to add new stuff onto the end of the (already-existing) file's contents, without destroying what's already within it? Then you specify append mode when you open the file, like this: >write_file_2.*****p #include <fstream> using namespace std; int main() { ofstream ofs{"my_file.txt", ios::app}; // opening file in append mode ofs << "Hello World!\n"; // note the newline character at the end } Similar to before, compile & run (note the different codefile name this time): g++ write_file_2.*****p --std=c++11 && ./a.out That's it in a nutshell, Anon. Have a look inside the textfile 'my_file.txt' that you created, both before & after running the 2nd version of the code (any number of times).
Edited last time by Chobitsu on 07/26/2023 (Wed) 06:56:37.
>>24208 Since we've already created the textfile onto disk during the previous post, here's an example of reading in a single line of text data from that same textfile (now being used as an input): >read_file.*****p #include <fstream> #include <iostream> #include <string> using namespace std; int main() { ifstream ifs{"my_file.txt"}; // input file should already exist // read in one line of text from input file : string line; getline(ifs, line); cout << line << '\n'; // display that line of text out to console } Be sure to build & run this new codefile, similar to the previous examples. --- Alternatively, using a while() loop, we can read in every line from that textfile and display it: >read_file_2.*****p #include <fstream> #include <iostream> #include <string> using namespace std; int main() { ifstream ifs{"my_file.txt"}; // input file should already exist // read in & display all lines of text from input file : string line; while (getline(ifs, line)) { cout << line << '\n'; } } Simple as. --- Hope all that helps, Anon. Next time, we'll be using these types of examples to explain functions. Stay tuned! :^)
Edited last time by Chobitsu on 07/26/2023 (Wed) 17:42:33.
>>23247 One issue the code has is that it sleeps for a relative amount of time in a loop. The problem is that the loop itself takes time. Some timing inaccuracies are unavoidable, this one can be avoided: >get the current monotonic time before entering the loop for the first time, assign it to a "timer" variable >go through the loop >at the tail of the loop, add interval to timer, where interval is the interval you want between each iteration of the loop, and sleep until that absolute time This is trivial in C and C++ with the POSIX clock_nanosleep() function. >>23110 stdout is line buffered if it's interactive. The meaning of interactive is implementation-defined. You can call setvbuf() on a FILE before it's first used to set a different buffering mode. Or you can build a buffer yourself and use write() directly to go a little faster.
>>24289 Hi Nagisa, thanks for the info! Good to hear from you BTW. >timing Yep, and C++ has an ever-more-powerful std::chrono library in the standard. It does make timing rather straightforward, and in a thread-safe way. [1] >stdout is line buffered if it's interactive. The meaning of interactive is implementation-defined. Ahh, thanks for clarifying that little point. >buffering general Yep. And the C++ streams libraries are incredibly flexible (if overly-large heh :^), and they allow for an array of buffering strategies (or you can extend them with your own as well). [2] One of the nice things that the modern version of C++ affords is a simplified, printf-like syntax for output operations, under std::format utility. This also includes the rather flexible approaches offered by iterators, and everything is done in a type-safe way. [3] There is even discussion ongoing in the Committee to break out the iostreams library to significantly reduce it's footprint in, say, embedded applications. 1. https://en.*****preference.com/w/*****p/chrono 2. https://en.*****preference.com/w/*****p/io 3. https://en.*****preference.com/w/*****p/utility/format/format
>>24291 >Good to hear from you BTW. Thanks. I'm always lurking, but don't have much to say. Currently studying some more advanced multithreaded programming with atomics and barriers.
hey its august back 2 school time *****
/robowaifu/ could I have some help with my first assignment? I regret taking the 2 month break and I probably should have done that. int main() { int x, y; char z; double rate, hours; double amount; . . . } Write the following function definitions: a. Write the definition of the void function initialize that initializes x and y to 0 and z to the blank character (use reference variables). b. Write the definition of the function getHoursRate that prompts the user to input the hours worked and rate per hour to initialize the variables hours and rate of the function main. c. Write the definition of the value-returning function payCheck that calculates and returns the amount to be paid to an employee based on the hours worked and rate per hour. The formula for calculating the amount to be paid is as follows: For the first 40 hours, the rate is the given rate; for hours over 40, the rate is 1.5 times the given rate. d. Write the definition of the function printCheck that prints the hours worked, rate per hour, and the salary. e. Write the definition of the function funcOne that prompts the user to input a number. The function then changes the value of x by assigning the value of the expression: two times the (old) value of x plus the value of y minus the value entered by the user. f. Write the definition of the function nextChar that sets the value of z to the next character stored in z. (Hint: add one to the char variable) g. Write the definition of the function main that tests each of these functions. I really hope I did the code thing right.
>>24378 everythings in the slides already, >>22902 >>22903 >>23049 is the majority this
>>24378 Hello Anon, welcome! So, you want to build robowaifus to help combat the plague of feminism spreading like a disease around the globe huh? You deserve applause from all men everywhere for that effort! :^) I suppose if you want us to help you with your homework, it's reasonable to try to ensure you understand the material itself. I'm sure your textbook has touched on user-defined functions already during this section, so it's probably good to start there. Can you give a reason why you might want to write your own functions in C++ code? I mean, a) why would you do so, and b) what benefit are they to you (especially later on, such as next week when you re-read your own code. :^)
>>24373 Didn't show up for the first semester, but I'm going to be the cool anime side-character that does well anyways due to sheer talent. Bring it on teach
>>24404 Hello Anon, welcome! >but I'm going to be the cool anime side-character that does well anyways due to sheer talent. I'd suggest you quickly work through the first 11 chapters in the month or so remaining before classes start then. It's cumulative information, and this next, very-tricky phase of class, builds on top of what's gone before ITT. Glad to have you with us, BTW. Cheers. :^) Good luck Anons
Hello, /robowaifu/. I actually wanted to extend an apology to everyone in this thread regarding this post I made. >>24378 I basically came in the thread and requested you all to do my work for me. This is the same lazy welfare king attitude we commonly see within section 8 housing. However, to prove to you that I'm not some brain dead Cotton Picker, I actually completed everything that I requested help with and mostly on my own. Here it is. #include <cmath> #include <random> #include <ctime> #include <iostream> #include <string> #include <iomanip> #include <cstdlib> using namespace std; void initialize(int &, int&, char &); void getHoursRate(double&, double&); double payCheck(double&, double&); void printCheck(double, double, double); void funcOne(int&, int&); void nextChar(char&); int main() { int x, y; char z; initialize(x, y, z); double rate, hours; double amount; getHoursRate(rate, hours); amount = payCheck(rate, hours); printCheck(rate, hours,amount); funcOne(x, y); nextChar(z); } void initialize(int& x, int& y, char &z) { x = 0; y = 0; z = ' '; } void getHoursRate(double& rate, double& hours) { cout << "How many hours did you work this week?"; cin >> hours; cout << "what is your rate of pay?"; cin >> rate; } double payCheck(double& rate, double& hours) { double amount = rate * hours; if (hours > 40) { amount = 40 * rate + (hours - 40) * rate * 1.5; } return amount; } void printCheck(double rate, double hours, double amount) { cout << " you worked " << hours << endl << "Your rate of pay was " << rate << endl << " your paycheck is " << amount << endl; } void funcOne(int& x, int& y) { double userNum; cout << " please input a number"; cin >> userNum; x = x * 2 + y - userNum; cout << "x is equal to " << x << endl; } void nextChar(char& z) { z = z + 1; cout << "this is what z is " << z; }
>>24682 Nice going Anon. You probably should work on the outputs a little further before turning it in. Here's my results using your code: $ build/_msc How many hours did you work this week?400 what is your rate of pay?500 you worked 400 Your rate of pay was 500 your paycheck is 290000 please input a number24 x is equal to -24 this is what z is ! BTW, please consider using clang-format . It will make everyone's life easier if you do. https://stackoverflow.com/questions/63914108/using-clang-in-windows-10-for-c-c https://superuser.com/questions/1505283/how-to-install-clang-format-on-mingw-window https://www.electronjs.org/docs/latest/development/clang-format Also BTW, if you do so, here is my recommended .clang-format file to use for formatting: (>>22143) --- BTW, I rm'd your file. /pol/ funposting is OK here in it's designated-containment thread (currently : >>24081). Otherwise, let's all try to keep things robowaifu-centric thanks. Cheers. >=== -add 'funposting' cmnt
Edited last time by Chobitsu on 08/18/2023 (Fri) 18:42:07.
Is it possible to implement C++ code into an HTML page? I know it's kind of an autistic question but I'd like to know if it could be done.
>>25198 I'm pretty sure Wasm works: >WebAssembly (abbreviated Wasm) is a binary instruction format for a stack-based virtual machine. Wasm is designed as a portable compilation target for programming languages, enabling deployment on the web for client and server applications. Developer reference documentation for Wasm can be found on MDN's WebAssembly pages. https://webassembly.org/
>>25389 >I'd love to join you on that C++ learning thread. I recently did really bad on a couple of C++ assignments related to classes. We've already gone through User-defined types, including classes. (>>22905, >>21780) So, we can review those topics here to help you get past your issues, Anon. Can you give, say, three examples from your classwork where you had some problems with classes? >Currently, I am studying stuff about vectors. Vectors are fairly easy for me to understand as they're just arrays that more flexible. Neat. The first three classes during this five-class, 2nd phase of our classroom are all about building a std::vector facsimile from scratch.
>>25198 Interesting question. If I understand you correctly, then yes, compiled C++ code can be executed via a web browser today. https://emscripten.org/
>>25394 Haha, nice one. :^) >tl;dr Debugging is still your fren. https://emscripten.org/docs/debugging/Sanitizers.html
Open file (692.94 KB 690x463 japanese confederacy.png)
>>25391 >Neat. The first three classes during this five-class, 2nd phase of our classroom are all about building a std::vector facsimile from scratch. Awesome. Also, due to the size of the programs I am working on, that size being fairly small, I use "using namespace std;" because I really do not like typing "std:: cout << " I hate using this "; I have heard it's bad programming practice for one reason or another.
>>25398 >I have heard it's bad programming practice for one reason or another. I don't particularly consider it bad practice per se, particularly for students. It's simply that when you're working as a professional, things can grow to a state of complexity that you definitely want things such as scoping (std:: namepace, etc.) spelled out explicitly -- and very close to the usage site in the codebase. >tl;dr using namespace std; is just fine for this class, Anon. So, back to classes. Mind spelling out some problems you're having with them? AMA.
Open file (297.77 KB 980x735 slide_01.png)
Open file (307.00 KB 980x735 slide_02.png)
Open file (277.78 KB 980x735 slide_03.png)
Open file (306.82 KB 980x735 slide_04.png)
Open file (302.37 KB 980x735 slide_05.png)
Lecture 07 begins 1
Open file (309.42 KB 980x735 slide_06.png)
Open file (292.84 KB 980x735 slide_07.png)
Open file (305.30 KB 980x735 slide_08.png)
Open file (284.75 KB 980x735 slide_09.png)
Open file (268.83 KB 980x735 slide_10.png)
Open file (260.26 KB 980x735 slide_11.png)
Open file (297.51 KB 980x735 slide_12.png)
Open file (294.05 KB 980x735 slide_13.png)
Open file (292.18 KB 980x735 slide_14.png)
Open file (302.44 KB 980x735 slide_15.png)
Open file (283.08 KB 980x735 slide_16.png)
Open file (283.04 KB 980x735 slide_17.png)
Open file (283.39 KB 980x735 slide_18.png)
Open file (294.63 KB 980x735 slide_19.png)
Open file (306.52 KB 980x735 slide_20.png)
Open file (307.01 KB 980x735 slide_21.png)
Open file (311.50 KB 980x735 slide_22.png)
Open file (303.99 KB 980x735 slide_23.png)
Open file (302.65 KB 980x735 slide_24.png)
Open file (281.97 KB 980x735 slide_25.png)
Open file (301.02 KB 980x735 slide_26.png)
Open file (301.81 KB 980x735 slide_27.png)
Open file (308.61 KB 980x735 slide_28.png)
Open file (301.68 KB 980x735 slide_29.png)
Open file (317.41 KB 980x735 slide_30.png)
Open file (302.45 KB 980x735 slide_31.png)
Open file (317.90 KB 980x735 slide_32.png)
Open file (295.56 KB 980x735 slide_33.png)
Open file (300.52 KB 980x735 slide_34.png)
Open file (298.26 KB 980x735 slide_35.png)
>>25489 Lecture 07 ends 7
>spare reserve
>spare reserve
>spare reserve
can you make a multidimensional vector like a [ ][ ] matrix? an actual matrix though not a vector of pointers to other vectors like *[ ]
>>25500 >“Well no, but actually yes.” You absolutely can, but it’ll look like you’re passing around pointers when you override the operator[] just due to how C++ works. That said, there won’t be any overhead due to it, cause under the hood, the opcodes were always going to be passing that row pointer around; all your data is still contiguous. Also, it’s worth noting Row-major vs. Column-major— always organize your datasets in a way that doesn’t “fight the cache” when you access them. Implementing it is basically allocating a single array and then adding helper functions to abstract how you slice into it: template<typename T> class SimpleMatrix { public: using dim_t = unsigned; using idx_t = unsigned; SimpleMatrix(); SimpleMatrix(dim_t rowCount, dim_t rowSize); ~SimpleMatrix(); inline T* operator[](const dim_t &x) {//row access const idx_t rowIdx = this->getRowOffset(x); return &(this->data[rowIdx]); } inline void resize(dim_t rowCount, dim_t rowSize) { return this->allocate(rowCount, rowSize); } protected: T *data; dim_t sizes[2]; idx_t totalSize; inline idx_t getRowOffset(dim_t y) { return y * sizes[1]; } inline idx_t getIndice(dim_t x, dim_t y) { return getRowOffset(y) + x; } void allocate(dim_t rowCount, dim_t rowSize); void deallocate(T *const old = nullptr); }; template<typename T> void SimpleMatrix<T>::allocate(dim_t rowCount, dim_t rowSize) { idx_t newTotalSize = rowSize * rowCount;//sizes[0] * sizes[1]; T *oldData = this->data; this->data = new T[newTotalSize]; if(oldData != nullptr) { dim_t oldRowSize = sizes[1], oldRowCount = sizes[0]; //IMPLEMENT ME! //if row sizes changed, mem*****y row-by-row //otherwise, if we only added more rows, just mem*****y the old to the first part of the new array this->deallocate(oldData); } sizes[1] = rowSize; sizes[0] = rowCount; totalSize = newTotalSize; } template<typename T> void SimpleMatrix<T>::deallocate(T *const old) { if(old != nullptr) delete old; else delete this->data; } template<typename T> SimpleMatrix<T>::SimpleMatrix() : data(nullptr), sizes{0,0}, totalSize(0) { } template<typename T> SimpleMatrix<T>::SimpleMatrix(dim_t rowCount, dim_t rowSize) : SimpleMatrix() { this->allocate(rowCount, rowSize); } template<typename T> SimpleMatrix<T>::~SimpleMatrix() { this->deallocate(); } And a simple example (showing cache-wise traversal): int rows = 2, columns = 3; SimpleMatrix<int> test(rows, columns);//2x3 matrix: 2 rows, 3 columns for(int y = 0; y < rows; y++) { for(int x = 0; x < columns; x++) { test[y][x] = x*10 + y;//Just store digitwise base10 } } for(int y = 0; y < rows; y++) { for(int x = 0; x < columns; x++) { std::cout << test[y][x] << "\t"; } std::cout << std::endl; } Btw, it’s usually best to differentiate between Vectors (the resizable data type) vs. Arrays (primitive, statically-sized ranges of sequential elements).
>>25500 >can you make a multidimensional vector like a [ ][ ] matrix? an actual matrix though not a vector of pointers to other vectors like *[ ] Yes. >matrix.*****p // compile & run : // g++ matrix.*****p -std=c++11 && ./a.out #include <iostream> #include <vector> using namespace std; int main() { // a 3x3 matrix of ints vector<vector<int>> mat{{00, 01, 02}, // {10, 11, 12}, // {20, 21, 22}}; // print matrix to console : for (auto const& row : mat) { for (auto const elem : row) { cout << elem << '\t'; } cout << '\n'; } } Simple as. BTW Anon, Stroustrup touches on creating a Matrix library (with all the usual helper functions) in ch 24 of PPP2, which we'll be working on next year during this classroom (all things being equal). Cheers. :^)
Edited last time by Chobitsu on 09/24/2023 (Sun) 17:41:09.
>>25501 Nice work Anon. I'd suggest you look ahead in our textbook to see where we're going with this idea. Cheers. :^)
>>25506 My bad— didn’t realize the question was in relation to the lecture lol Ah well, ‘least I already had the code sitting around and only spent a few minutes simplifying/de-template’ing it Worth noting that >>25502 *is* effectively a vector of pointers (vectors holding a pointer to their dynamic data region) as far as optimization is concerned (double-deref with dependent lookup), but as they always say: >premature optimization is the root of all evil
>>25517 >My bad— didn’t realize the question was in relation to the lecture lol Heh, for your case in particular, I meant skip ahead to ch 24 of the book (and indeed on through to the end of it). :^) >Worth noting that >>25502 *is* effectively a vector of pointers (vectors holding a pointer to their dynamic data region) as far as optimization is concerned (double-deref with dependent lookup) Yep, you're right. Though Anon's question was primarily about value-semantics (C++), versus reference-semantics (C), within user code; in the context of a baseline mathematical matrix. My example type given is the most direct solution for that, code-wise. A std::vector is in effect a general (as in: can contain any type, including user-defined ones), flexible (as in: can grow & shrink in size, and be passed cleanly across interfaces), 'intelligent' C-array-like type that: * always knows it's own size, * won't decay into a pointer at the drop of a hat, * is always strongly type-checked (both inside & 'out'), * is quite efficient in general, * and always cleans up properly after itself. You can also spend run-time bounds checking (ala Ada, et al) directly if you care to do so, but it's not required of course [1]. In real production systems you'll typically want to optimize the std::vector's memory storage footprint as well, if/when you know that specific requirement [2][3]. There are numerous other benefits with std::vector in addition (particularly in the contexts of thread-safe concurrency/parallelism usage). BTW, any anon who actually does the work through this lecture and the next two (PPP2 chs 17, 18, 19), will thereafter understand how to build a mostly-complete Vector -alike from scratch with no more understanding of memory needed than for that of a C-array. This kind of knowledge is really powerful for a beginner, and the std::vector is exactly the right type to thus intently study. Very wise of Bjarne Stroustrup to do so IMO. 1. https://en.*****preference.com/w/*****p/container/vector/at 2. https://en.*****preference.com/w/*****p/container/vector/reserve 3. https://en.*****preference.com/w/*****p/container/vector/shrink_to_fit
Edited last time by Chobitsu on 10/01/2023 (Sun) 05:30:41.
Open file (220.57 KB 816x612 lec_08_slide_01.png)
Open file (218.65 KB 816x612 lec_08_slide_02.png)
Open file (210.07 KB 816x612 lec_08_slide_03.png)
Open file (225.17 KB 816x612 lec_08_slide_04.png)
Open file (227.78 KB 816x612 lec_08_slide_05.png)
Lecture 08 begins 1
Open file (221.49 KB 816x612 lec_08_slide_06.png)
Open file (222.27 KB 816x612 lec_08_slide_07.png)
Open file (223.01 KB 816x612 lec_08_slide_08.png)
Open file (223.44 KB 816x612 lec_08_slide_09.png)
Open file (222.06 KB 816x612 lec_08_slide_10.png)
Open file (224.14 KB 816x612 lec_08_slide_11.png)
Open file (216.48 KB 816x612 lec_08_slide_12.png)
Open file (213.31 KB 816x612 lec_08_slide_13.png)
Open file (225.72 KB 816x612 lec_08_slide_14.png)
Open file (207.27 KB 816x612 lec_08_slide_15.png)
Open file (209.62 KB 816x612 lec_08_slide_16.png)
Open file (225.53 KB 816x612 lec_08_slide_17.png)
Open file (203.08 KB 816x612 lec_08_slide_18.png)
Open file (215.91 KB 816x612 lec_08_slide_19.png)
Open file (213.69 KB 816x612 lec_08_slide_20.png)
Open file (223.57 KB 816x612 lec_08_slide_21.png)
Open file (207.58 KB 816x612 lec_08_slide_22.png)
Open file (221.58 KB 816x612 lec_08_slide_23.png)
Open file (224.58 KB 816x612 lec_08_slide_24.png)
Open file (226.26 KB 816x612 lec_08_slide_25.png)
Open file (227.09 KB 816x612 lec_08_slide_26.png)
Open file (220.94 KB 816x612 lec_08_slide_27.png)
Open file (214.38 KB 816x612 lec_08_slide_28.png)
Open file (211.13 KB 816x612 lec_08_slide_29.png)
Open file (230.85 KB 816x612 lec_08_slide_30.png)
Open file (228.64 KB 816x612 lec_08_slide_31.png)
Open file (224.53 KB 816x612 lec_08_slide_32.png)
Open file (226.89 KB 816x612 lec_08_slide_33.png)
Open file (210.53 KB 816x612 lec_08_slide_34.png)
Open file (222.43 KB 816x612 lec_08_slide_35.png)
Open file (221.97 KB 816x612 lec_08_slide_36.png)
Open file (229.46 KB 816x612 lec_08_slide_37.png)
Open file (218.88 KB 816x612 lec_08_slide_38.png)
>>25608 Lecture 08 ends 8
>spare reserve
>spare reserve
>spare reserve
Lecture 09 begins 1
Edited last time by Chobitsu on 11/04/2023 (Sat) 16:22:19.
Edited last time by Chobitsu on 11/04/2023 (Sat) 16:22:31.
Edited last time by Chobitsu on 11/04/2023 (Sat) 16:22:44.
Edited last time by Chobitsu on 11/04/2023 (Sat) 16:22:58.
Edited last time by Chobitsu on 11/04/2023 (Sat) 16:23:10.
>>26196 Lecture 09 ends 9
>spare reserve
>spare reserve
>spare reserve
how do you make a vector with function pointers? im trying to make a callstack
>>26201 trying to do vector<int *(int, ...)>func(5) but it prints an entire page of garbage as an error message cant even read any of, with an array its fine though int (*func[5])( int, ... )
>>26201 >>26204 >im trying to make a callstack Neat! I'm not on a box I can do a quick check for you, but it seems to me this should probably work: vector<int (*)(int, ...)> func(5) I'll take a look at it sometime tomorrow when I'm better able to. BTW, since you're using C++ you can probably take advantage of that and go all the way to creating a full class for your Callstack with all the bells & whistles neatly packaged up?
>>26206 I'm not into C++, so I can't help you directly. But if you would use the Opera browser for your project, then you could use chatGPT (3) in the sidebar the whole time. I'm having positive experiences with it, asking about Python, libraries, examples, Emacs shortcuts, fixing some code, making it shorter ... As I said, not C++ but Python, though it might work for C++ as well. With an account on sites like Poe.com you can also ask bigger models on their site.
>>26201 >how do you make a vector with function pointers? Here's a quick example using C++11 lambdas, Anon. Hopefully this will get you kickstarted : >callstack_main.*****p // build & run : // g++ callstack_main.*****p -std=c++14 && ./a.out #include <functional> #include <iostream> #include <vector> using namespace std; // a couple of arbitrary void functions : void prt_num(int i) { cout << i << '\n'; } void prt_dbl_num(int i) { cout << (i * 2) << '\n'; } int main() { // an empty vector of void functional types vector<function<void()>> funcs; // store a few lambdas (aka, 'closures') into the container : funcs.push_back([]() { prt_num(42); }); funcs.push_back([]() { prt_num(700); }); funcs.push_back([]() { prt_num(9'001); }); funcs.push_back([]() { prt_dbl_num(42); }); funcs.push_back([]() { prt_dbl_num(700); }); funcs.push_back([]() { prt_dbl_num(9'001); }); // execute all stored functionals, beginning to end for (auto const& fn : funcs) fn(); } >output: 42 700 9001 84 1400 18002 Try that (adapting it to your specific usecase ofc), then let me know how it goes please. Cheers. :^) >>26211 Thanks NoidoDev! That's good advice, and much appreciated. Cheers. :^) >=== -edit code example
Edited last time by Chobitsu on 11/05/2023 (Sun) 15:57:55.
>>26215 nice thats what i needed, ty
>>26221 Great. Please post results when you've perfected everything Anon. BTW, now you're rolling with things, I'd suggest you investigate std::stack[1]. I believe you'll find all the semantics you want all there for you in a purpose-designed C++ container. Cheers. :^) 1. https://en.*****preference.com/w/*****p/container/stack
>>26222 thanks was just playing around and made a simple regex engine, the ugliness is unavoidable i think#include <functional> #include <iostream> #include <vector> #include <cstring> using namespace std; class regex { public: struct { const char *ptr; int cur, len; }Text; struct { int cur, len; }Match; const char *expr; int cur; vector<function<int()>> funcs; void reset( void ) { Text.cur = 0; } int mChar( const char c ) { return ( Text.ptr[ Text.cur ] == c ); }; int mAny( void ) { char c = Text.ptr[ Text.cur ]; return ( c != '\n' ) & ( c != '\0' ); }; int mOpt( void ) { int m = funcs[ ++cur ](); Text.cur -= !m; return m + !m; } int mMulti( class regex *Left, class regex *Right, int greedy ) { int m; int save = Left->Text.cur; Right->Text.len = 1; do { m = Left->funcs[ Left->funcs.size() -2](); Left->Text.cur += m; Right->Text.len += m; } while ( m ); Left->Text.cur = save; Right->Text.ptr = &Left->Text.ptr[ Left->Text.cur ]; Right->Text.cur = 0; Right->exec(); int ret = Right->Match.cur + Right->Match.len ; if ( greedy ) do { ret = Right->Match.cur + Right->Match.len ; m = Right->exec(); } while ( m ); return ret; } int exec( void ) { if ( Text.cur >= Text.len ) return 0; for ( cur=0; cur<funcs.size(); cur++ ) { int m = funcs[ cur ](); if ( m ) { Text.cur += m; continue; } cur = -1; Text.cur = Match.cur + 1; Match.cur = Text.cur; if ( Text.cur >= Text.len ) break; } Match.len = Text.cur - Match.cur ; return Match.len; }; void bind( const char *text, int len ) { Text.ptr = text; Text.len = len; Text.cur = 0; } void compile( const char *expr ) { funcs.clear(); this->expr = expr; int len = strlen( expr ); for ( int i=0; i<len; i++ ) switch ( expr[i] ) { case '\\': // escape ++i; default: // char funcs.push_back([this,expr,i]() { return mChar( expr[i] ); } ); break; case '.': // any funcs.push_back([this]() { return mAny(); } ); break; case '?': // zero or one if ( !i ) break; case '*': // zero or more funcs.push_back( funcs.back() ); funcs[ funcs.size() -2 ] = [this]() { return mOpt(); } ; if ( expr[i] == '?' ) break; case '+': // one or more class regex *Right = (class regex *)calloc( sizeof(class regex), 1 ); Right->compile( &expr[i+1] ); funcs.push_back ( [this,Right,expr,i]() { return mMulti( this, Right, ( expr[i+1] != '?' ) ); } ); return; } }; }; int main() { class regex Expr1 = {}; Expr1.compile( "t5?.+?st\\?.x+ s.*enX*d" ); Expr1.bind( "afsd test?xxx sqwe enp end? @@", 12 ); int m = Expr1.exec(); printf( "\033[1;7;93m str = '%s' \n\033[0m" "\033[1;7;96m expr = '%s' \n\033[0m" "\033[1;7;92m pos=%d len=%d \n match = '%.*s' \n\033[0m", Expr1.Text.ptr, Expr1.expr, Expr1.Match.cur, m, m, &Expr1.Text.ptr[Expr1.Match.cur] ) ; }
>>26231 Wow very nice stuff Anon! Some clever things going on there. Also, very cool to me personally seeing you embracing the benefits of C++ . I too trod a path of C first, then C++. They are definitely different ways of thinking about & doing things, but IMO the further along you get in the journey towards mastery of C++, the more you wind up mostly :^) appreciating much the language has to offer. >tl;dr Eventually this language becomes rather fun to use (explicitly one of Bjarne's major stated goals) and the power of free abstractions simply can't be beat! or ignored, IMO. :^)
Lecture 10 begins 1
>>26325 Lecture 10 ends 9
>spare reserve
>spare reserve
>spare reserve
Open file (80.73 KB 1079x791 virginityiscool.jpg)
>>26326 My C++ teacher docs points on my assignments when I add lying berries to my programs but don't use them. Like if i had <fstream> but didn't have any files read in the program. I just copy and paste from a large list and then slap it in my program. I wish he didn't do that but oh well. As a programmer, is it bad programming practice to add certain lying berries to your program if you don't use them? like adding <string> to your program but not having any strings?
>>26365 >As a programmer, is it bad programming practice to add certain lying berries to your program if you don't use them? like adding <string> to your program but not having any strings? Please define 'lying berries' for me a bit clearer, Anon. As to adding superfluous #includes, it simply adds slightly to the compilation process workload (by expanding the entire text of the string library and all it's dependencies in-place as a preprocessing step). Otherwise it has no effect on the compiled binary in either size or runtime. OTOH, it's certainly considered bad form to do so, as well as adding anything unnecessary to the code in the file you're working on. At the small scale you're likely to encounter as a student, these are relatively trivial concerns. Once you're coding professionally, you may be working on 1M+ line codebases (such as a robowaifu's), and such faux pas can be a real nuisance. Best to take your instructor's advice in this specific matter Anon. He's just trying to prepare for the real world in this case.
Open file (15.24 KB 292x268 terrydavissmile.jpeg)
>>26366 >Please define 'lying berries' for me a bit clearer, Anon. Sorry, I was just joking around. libraries sounds kind of like "Lying berries" so I thought it was funny. Thanks for clearing that up for me, I just wanted to know if he was right and it turns out it is. Another reason I wanted to do that is because It's sort of like a signature of mine. Like "oh hey look at all these extra libraries added on , this is definitely anon's work. " One of my biggest fears with my programming classes is to get accused of using AI. I know it happened at a university in Texas recently.
>>26369 >Thanks for clearing that up for me Nprb, I'm glad you're asking about such things since it helps clear up misconceptions in the beginner's minds (this is a classroom thread after all heh). For example, most students think that the compiler is somehow involved with the runtime operation of their programs. It isn't. The binary runs without any compiler interaction at all. Stuff like that. >One of my biggest fears with my programming classes is to get accused of using AI. I know it happened at a university in Texas recently. Honestly, that's their problem IMO, not yours. Just find a consistent naming/commenting/formatting style (please use clang-format, kthx) and that should go a long way for you while you're a student. >also, > based schizo pic saved. :^)
Open file (15.36 KB 576x294 2023-11-13_10-48-26.png)
Open file (15.92 KB 591x304 2023-11-13_10-49-09.png)
>>26365 >>26366 One other thing I might add; the reference sites will tell you about which libraries are needed, for which standard C++ facilities you need. For example, here's vector:[1] > #1 and map:[2] > #2 1. https://en.*****preference.com/w/*****p/container/vector 2. https://en.*****preference.com/w/*****p/container/map
>>26392 why arent there just man pages for c++ like with libc
>>26394 nvm saw theres a libstdc++-10-doc package its just not installed by default
>>26394 >why arent there just man pages for c++ like with libc Yeah, it's an issue. Here's a hack: https://github.com/jeaye/stdman
Lecture 11 begins 1
>>26485 This completes our second phase of the class. That's it for this year, Anons! See you in the new year where we'll pick up with PPP2 ch12 & GUIs. :^) Lecture 11 ends 8
>spare reserve
>spare reserve
>spare reserve
A NEW VERSION OF BJARNE STROUSTRUP'S FRESHMAN TEXTBOOK HAS JUST DROPPED! [1] This is really encouraging to me r/n, Anons. It was such a long delay for this update, that I had finally given in and figured that Bjarne was too tired to focus on education for the language any longer thus my own feeble attempts to take up that mantle, such as they are. :^) BUT NO. He fooled me, heh. :D PPP3 is out now (already have my ebook, and the print copy is on the way lol), and there are a couple of big changes: * The book has been cut basically in half! About a dozen PPP2 chapters were removed for this edition, and are now freely available on the book's site for download as .pdf files. * The underlying graphics library is no longer based on FLTK, but on Qt. This is a significant change for those 5 chapters, I expect (I'll let you know). Lots of ppl had trouble getting FLTK working properly on their machines -- and Qt has slick, pre-built installers for many platforms -- so this will likely be a benefit for most Anons learning this most important language to us, through this textbook. SO... Since I was basing this entire class on PPP2, I'll now have to rethink where we're going with it. Very likely I'll lock this thread and the textbook thread permanantly -- and redo the entire thing for PPP3. :^) This will also include the rentry copy of the work. So this means a LOT of additional, new work on my part that I hadn't planned for this year. So, for now, and until further notice, this class is cancelled. I imagine I may be able to pick it back up during the upcoming Winter semester with the new content, but maybe it'll have to be a year from now instead, Lord willing (I currently have a lot on my plate already). Also, I'm not sure how to manage it here on /robowaifu/ now that I myself can't even post files here any longer lol. Maybe we'll put it on Trash instead? Regardless, this is very good news for /robowaifu/ and other Anons. We're going to need probably at least a dozen Anons skilled in programming with C++ here, to pull off our good opensauce robowaifu's 'minds'. Anything that makes learning this powerful systems-programming language easier is quite helpful in this regard. Man, what a great timeline -- this is encouraging! Cheers, /robowaifu/ . :^) --- >" An Introduction to Programming by the Inventor of C++ >Programming: Principles and Practice Using C++, Third Edition, will help anyone who is willing to work hard learn the fundamental principles of programming and develop the practical skills needed for programming in the real world. Previous editions have been used successfully by many thousands of students. This revised and updated edition >Assumes that your aim is to eventually write programs that are good enough for others to use and maintain >Focuses on fundamental concepts and techniques, rather than on obscure language-technical details >Is an introduction to programming in general, including procedural, object-oriented, and generic programming, rather than just an introduction to a programming language >Covers both contemporary high-level techniques and the lower-level techniques needed for efficient use of hardware >Will give you a solid foundation for writing useful, correct, type-safe, maintainable, and efficient code >Is primarily designed for people who have never programmed before, but even seasoned programmers have found previous editions useful as an introduction to more effective concepts and techniques >Covers a wide range of essential concepts, design and programming techniques, language features, and libraries >Uses contemporary C++ (C++20 and C++23) >Covers the design and use of both built-in types and user-defined types, complete with input, output, computation, and simple graphics/GUI >Offers an introduction to the C++ standard library containers and algorithms " --- GET STOKED with me, /robowaifu/ !! TWAGMI :DD --- 1. https://stroustrup.com/programming.html >=== -fmt, prose edit
Edited last time by Chobitsu on 04/28/2024 (Sun) 01:00:32.
>>31023 Maybe this will interest you, maybe not, but it sure looks interesting to me. And so you will at least think about it, "...Written in C for maximal compatibility (C++ compatible)..." Which I know makes you happy. Look at this killer GUI library. It looks great AND it even runs on microcontrollers including the ESP32(which is how I found it) LVGL - Light and Versatile Graphics Library https://github.com/lbcb/LittlevGL Look at the live demos below in a browser. They look really good. Maybe...instead of the huge library they are using in the book you could cut a great deal of effort and time out by using a nice little package. https://lvgl.io/demos This liberty is really impressive, especially that they can fit so much into such a tiny library. Size will be at a premium in waifus. Most of the computing power will be likely sucked up, eventually, by AI routines. It even supports the RTOS that can be used in microcontrollers. Like it or not any sophistication at all in a waifu is more than likely going to have some small RTOS. If only to make things easier to manage all the timing. Here's a cool ESP32 demo https://github.com/lvgl/lv_port_esp32 I wonder, wild ass wondering, if some of the structure of this, since they pack so much into such a small library, could not be repurposed for facial features??? Not that you use this library itself but maybe the structural ideas behind it. I can't remeber where I saw it but there was some graphic with all the various facial emotions displayed by humans and there were not too many. Maybe there could be 10 or 20 and then the rest would be mixes or blends of these basic emotions. Combined with a little slight randomness it could fake real emotion with a tiny library that was fed "emotion state keywords". All the rest would be coordinated at the low level by various muscle actions from the keywords controlled by the library.
>>31046 Really interesting stuff, Grommet. I'll certainly look into this! Cheers. :^)
>>22143 > local file -related : >>34006

Report/Delete/Moderation Forms
Delete
Report