Showing posts with label copilot. Show all posts
Showing posts with label copilot. Show all posts

Saturday, October 24, 2026

AI Is Getting Scary

Recently on Facebook, slider puzzle games came up in discussion. I remembered writing a program for playing one of those games and decided to see if I still had one. I did find one. It created a form and let me easily move the "boxes" around. It didn't 1) check to see if everything was in the right place 2) shuffle. So I decided to add those features. Enter GitHub Copilot which is built into Visual Studio.

I started writing an if statement in the appropriate place and Copilot offered the option to call a method called CheckWin. OK I let it finish.

Obviously, I needed CheckWin to be written.  I started writing "private ..." and it offered "bool CheckWin etc." so I let it create the method to see what it came up with. What it wrote works fine although not the same as I would have written it. But ok. CopIlot sure did do a good job of anticipating what I wanted.

My  next step was to add a shuffle method. I started writing "private void Shuffle" and it offered to write the method. That it did pretty much as I would have. So in a few minutes I had everything I needed.

Not sure how I feel about this. How did it figure out what I was up too? Does it have sort of understanding of the words I am using?

Of course, I am working on well-known, established, and simple programming here. There are probably dozens of examples of code on the Internet already that handle these sorts of puzzles. I am not asking AI to do anything new or innovative. Just how useful would AI be if I were working on problems no one has seen before?

None of this is perfect though. Some of the variable names, both that I wrote and that AI wrote, are not particularly informative. I assume I could ask CoPilot to rename things and I may do that. I do believe that the human touch in selecting names may be better than what AI comes up with however.

When if comes right down to it, I will probably not really understand the limits and abilities of AI until I decide to tackle a non-trivial and innovative project. And that is going to take some effort.

Saturday, December 27, 2025

AI Written Code and Making Assumptions

I’ve been writing some code for my own amusement the last few days. I have happily using Microsoft CoPilot to help me out. One really has to be careful with prompts though. CoPilot loves to make assumptions about what the developer desires. Often, it assumes correctly. Often enough, it assumes incorrectly.

I spent a good bit of time trying to figure how where it was doing some things I didn’t want done at all and other places where it got my intentions backwards. For example, we both had different ideas about what a variable called _defaultColor should refer to. That took me a bit.

I could have tried to ask CoPilot to fix the problem for me but if I had a better idea of how to express what I wanted it would probably have gotten things right, for my definition of right, the first time. So I fixed it myself.

I also made some assumptions about what certain methods were doing. I mostly assumed correctly but mostly is not really good enough when dealing with code. I really should have spent more time reading the code and making sure I understood it before trying to modify it. Yes, I said it before knowing how to read code is more important than ever.

Reading code on a screen can be painful though. One tends to get a sort of tunnel vision looking at little bits of code at a time. Many years ago I worked with a developer who had a terminal that was originally developed to typesetting at newspapers. It was tall and could hold a lot of lines of code. It was great for reading code. I don’t have anything like that. For me, the answer is printing listings out on paper. Maybe its just me but that is what has worked well for me for over 50 years of writing code.

I have more modifications I want to make to my program. I’ll spend some serious time reviewing the generated code before I try to make those modifications.

Related read: "Source code is the literature of computer scientists." https://www.cs.uni.edu/~wallingf/blog/archives/monthly/2025-12.html#e2025-12-26T18_28_37.htm A post by Eugene Wallingford

One other note, CoPilot added a lot of helpful error handling code to what I asked. That’s awesome in a lot of ways. I think that spotting a lot of error handling code may be something that tips off an educator that a student used artificial intelligence to write their code. Keep a look out and be sure to ask the student to explain it all.