Questions tagged [pascal]
Pascal is an imperative language from the Wirthian family created in 1969. It lives on in compilers like Free Pascal and Delphi.
27
questions
0
votes
0
answers
10
views
Creating a matrix or matrices for positioning squares on screen
The following implements a mix of hard-code (manual pick and choose) and abstracted solution for creating and placing some squares on screen using different matrix patterns for positioning. Each ...
2
votes
0
answers
15
views
Recording/Playback thread device in Object Pascal
I have developed an audio recording and playback base device in Free Pascal. This device is built on Free Pascal's TThread class and utilizes the low-level audio ...
2
votes
0
answers
46
views
max() without arithmetics or so
I have a plan to make something to solve this stuff:
You have 7 chips that are on the run. each has some cargo loaded. And also there's where record on each....
2
votes
1
answer
669
views
X, Y Coordinates class in Lazarus (Delphi-like)
After I've now officially announced, that I'm discontinuing my color picker for Windows, I'm about to embark on a journey through Linux development.
I was quite strong in Delphi on Windows, and see ...
5
votes
1
answer
410
views
Expand every bit into a byte
I have the following code:
...
2
votes
1
answer
284
views
Inserting an element into a linked list
This program adds an element to the end of a linked list of integers, which is previously keyed in by the user. This works fine on my computer, but I am wondering:
If there is a simpler way to do ...
4
votes
1
answer
3k
views
Merge two integer lists in Pascal
The purpose of the code is to merge two ordered lists (list 1 : 5 integers, list 2 : 8 integers) into another third ordered list, whilst maintaining their order, while entries that appear in more than ...
6
votes
1
answer
76
views
Prompt user to enter boat details and print them
My code works perfectly fine but I was wondering if there was any better ways I could write my code like tidy it up a bit or rewrite a part of it. I want to learn how I can write my code in a better ...
2
votes
1
answer
467
views
Counting the number of letters in a .txt file in Pascal
I wrote this program that counts the number of letters in random.txt file in the Pascal programming language.
It doesn't matter if the letters are capitalized. Other characters are ignored. When it ...
4
votes
2
answers
1k
views
Pascal Bubble Sort Implementation
I would prefer a review of:
Efficiency
Standards
Different approaches
Here's the code:
...
2
votes
1
answer
816
views
Semi-Reliable Communications Using UDP
I'm writing a communications library for a class. Part of the requirements is that semi-reliable communications, which leads me to this monstrosity:
...
12
votes
1
answer
16k
views
Human-like mouse movement
The code will move the mouse from a start point (xs, ys) to finish point (xe, ye) like a human would.
I'd like some help possibly shortening the code (by optimizing it) and making it more readable.
...
8
votes
1
answer
216
views
Auto-click the sequence
The following Pascal script needs a bit of context for its purpose to be understood. For those who don't give about purpose, feel free to skip ahead.
Background
A game I'm terribly fond of has a ...
2
votes
1
answer
96
views
Giving money to the bank
Lets say we need to write an algorithm for giving money to the bank. We need to know interest rate, money which we put every year on our account, and amount of money we want to get. F.e int. rate is 1%...
3
votes
1
answer
909
views
Binary and linear search methods for a number-guessing game
This is a code written is Pascal (Delphi). It asks the user to think of a number between min_ and max_ and then guesses the ...
3
votes
1
answer
109
views
Pass the password back
This code simply receives a very basic 'password' (numbers, letters, nothing fancy). After you press enter, it will display it back. The only special key I'm handling is backspace (code ...
4
votes
2
answers
90
views
Generating Position
I'm written the following code to calculate the position of a motor during each timestep, the result of which will be compared with feedback from a quadrature encoder and subjected to a PID algorithm. ...
3
votes
1
answer
128
views
Yellow Pages Search
I've written code in Free Pascal based on a contest problem (The contest insists that I have to write with Pascal). It works like charm, but I think it still need some improvements, from memory usage ...
3
votes
2
answers
75
views
4
votes
0
answers
958
views
Multithread debug logger for Free Pascal / Lazarus
Debug experience can be much improved in the Lazarus development interface. Please, if you use this free development environment and have the same felling, do not consider this affirmation simply as a ...
3
votes
1
answer
14k
views
Function to split text
The following pascal function (compiled with Delphi) will split strings. It works perfectly, but how to improve the code? For example, to avoid using the repeat-until loop.
...
10
votes
1
answer
500
views
Sync eye movements with external events
This solution was used to synchronize events between two applications: An eye tracking software, Python, and a stimulus control software, object Free Pascal/Delphi. It avoided a rewrite of the ...
8
votes
1
answer
527
views
Enhancing speed of looping cycle using Freepascal
I use Lazarus 1.2.4 and Freepascal 2.6.4.
I have created a program that reads a disk in buffers of 64Kb (tried various buffer sizes) using a repeat...until loop. Each buffer is hashed using the SHA1 ...
7
votes
1
answer
412
views
Drawing and Painting a Menu Component
I have produced a working menu component for a project I'm working on, but would like to reduce the amount of code used and improve the methods - especially in the Paint implementation - still further,...
7
votes
1
answer
308
views
Eight Directions Crossword
I solved a problem which you can read about here, but it gives me "time limit exceeded" even though it runs in 4 seconds. I really don't understand why.
I don't think my code can be any simpler, ...
3
votes
1
answer
615
views
Painting Tom Sawyer's Fence - programming on Free Pascal
Tom Sawyer has many friends who paints his fence. Each friend painted
contiguous part of the fence. Some planks could stay unpainted, some
could be painted several times. Program must output the ...
6
votes
2
answers
841
views
Querying MySQL from an external application
I have a database that I need to query over and over as fast as possible. My queries execute pretty quickly, but there seems to be some additional lag. I have a feeling that this lag is due to the ...