Deterministic Finite State Automata – Tool for verification and advantage to coding

Suppose I have modeled the behavior of my system by Deterministic Finite Automaton (DFA) A, and I need to check if it satisfies a safety condition. I have created another DFA S, which represents the behavior that invalidates the safety property. Then I need to take intersection of these two to see if A contains bad traces. Finally, I need to code A into C program.

  • Could you please introduce me to a few tools that take two DFA as input and tell me if the intersection is not empty?

  • Could you please tell me what is the benefit of using two DFA instead of coding in C in the first place (without using DFA)?

Many thanks

A plan coding a card game with a different concept

I want to design a multi-player card game that inculde: – two teams of multiple players. – the game has rounds and each round a player is kicked. – a manager who can start/end each round but cannot see the cards. – one of the cards of team A can kick a player every round. – one of team B is able to flip a card of any other player every round (once of course) – voting system.

I need to know what should I learn to design this game (Im a graphic designer)..

Thanks

Is there a way to solve coding challenges more easy?


I’m always using debugging and writing test cases to solve coding challenges. It’s been very helpful so far but now that problems became very complex, its not good enough.

Is there a way to use tools like:

  • state machine diagrams
  • logic tables
  • regular expressions
  • something else

in order to create from there the pseudo code or something that provides a cognitive structure to create from there the implemented code in the technology of preference: C, C++, Javascript, etc.

In other words:

  • A verification process where I check my solution or part of it is going to work before typing anything in the keyboard

  • A scaffold to the thinking process in order to arrive at the solution faster and with better quality

  • A theoretical frame to make the solution faster by not testing so much.

  • A model from which the pseudo code can emerge easier.

  • A workflow that relies less in heuristics and more on some other formal method

This is the coding challenge that made me think it could be solved in a more professional way:

  1. https://imgur.com/eW1bh5r
  2. https://imgur.com/cTulsGL
  3. https://imgur.com/4EeTC6Z
  4. https://imgur.com/ewVwb8K

Maybe this question belongs to https://cs.stackexchange.com and not here. I’m sorry if there is a way my question doesn’t meet the standards. If so, please let me know how to perfect it. This is my first one and I have no intent in bringing trouble to the community. I know this question might be very vague but my doubt is very vague too. Because I’m not only asking for directions, I’m also asking where to go.

Is there a way to solve coding challenges more easy?


I’m always using debugging and writing test cases to solve coding challenges. It’s been very helpful so far but now that problems became very complex, its not good enough.

Is there a way to use tools like:

  • state machine diagrams
  • logic tables
  • regular expressions
  • something else

in order to create from there the pseudo code or something that provides a cognitive structure to create from there the implemented code in the technology of preference: C, C++, Javascript, etc. This is an example problem:

I’m sorry if there is a way my question doesn’t meet the standards. If so, please ley me know how to perfect it. This is my first one and I have no intent in bringing trouble to the community. I know this question might be very vague but my doubt is very vague too.

Is using “typedef” in union definition bad according to Linux kernel coding style? [on hold]

I am trying to write my code using the Linux kernel coding style as the guide. In this guide there are clear indications about when to use “typedef” and when to not use them, but it only references structures or pointers: https://www.kernel.org/doc/html/v4.10/process/coding-style.html

Will these rules apply for unions or enums, for example? If yes, for the same reasons or different ones?

I found this question which doesn’t quite answer my question in the general sense: When to use typedef?

I apologize if this question is not suitable for this site. If that is tha case can you please direct me to where I might ask this?

In TDD, should we specifiy all classes to implement before start coding

My team is interested to apply TDD in our next software project. We have a discussion about how many details should be specified in design specs before the developers start coding.

Some of us propose that we should specify all classes and their relationship in specs before writing code because we have to design all test cases before implementing.

Some of us doubt that this will work practically. In previous projects, we only have a high-level design and let the developer designs the detail classes and methods on their own. The level of the detail in the specs is depending on the complexity of the requirement and experience of the developer. We write the specs only as detailed enough as to make the developer understand what should be done.

I am personally on the latter side of the discussion. I used to try to specify every bit of classes and methods in the specs in my previous projects before. Following are some example of problems that I encountered from doing so.

  • It takes too much time. To be able to design every classes and methods, an SA will more or less have to wear a developer hat to make sure that every bit of the design can be mapped to the actual code. As a result, the design often does not differ much from the implemented code. We have to work twice on the same thing: for the design and the implementation.

  • The developer does not have room to think. Writing the design this way sometimes leave only trivial logic for the developer to implement. It is like a fill in the blank kind of exercise for students.

  • The design often is premature. The design is done on a paper. We don’t see how the code is actually running. There are some details we can only know when get our hand on the code. For example, the underlying framework might enforce us to design classes in some way and we don’t know this while doing the design. And it is common to refactor some logic in a method to another class when we found appropriate. It’s natural that new components can pop up during implementation.

I have tried researching on the Internet and found only this article related to this topic. The article seems to support my belief as it suggests that we don’t have to do TDD on the detail classes.

However, the reference is not enough for us to decide. It is possible that designing every classes and methods is the right path and we just don’t know the procedure to achieve that.

Please share your opinion, experience or references. Do you think we should d design every classes and methods in specs before writing code?

What is the possibility of being denied entry at the US border if I have a valid B1/B2 visa and I plan on attending a coding school?

In February I applied for a B1/B2 visa to attend a bootcamp style coding school in the US. I am a UK citizen and I was applying in the London embassy. I had a letter from my employer stating that I was taking a sabbatical. My visa was denied – I was handed a standard 214b refusal letter – and also told that they did not believe that I would be “engaging in productive work in the US”. They also mentioned being concerned about my finances.

In April I received a scholarship and took out a large loan to finance the trip. I also took with me a more detailed letter from my employer outlining why this course in particular was needed for my professional development at work. Given the change in circumstances, I again applied for a B1/B2 visa (same embassy). This time I was approved, but during the interview the visa office said “this is a particularly complicated case” and also “you sit within a grey area of the law”.

I am concerned now that I may face these same issues at the border. Is this likely? Is getting an approved visa harder than getting accepted at the border? What actions should I take to ensure that I am able to pass through successfully? What should I do if I am denied?

It seems to me that bootcamps and short coding courses/schools are not very welcome by US immigration officials as they don’t fall neatly into either a student visa (it’s not an officially recognised institution) or a business/tourist visa.

How does a predictive coding aid in lossless compression?

I’m working on this lab where we need to apply a lossless predictive coding to an image before compressing it (with Huffman, or some other lossless compression algorithm).

From the example seen below, it’s pretty clear that by pre-processing the image with predictive coding, we’ve modified its histogram and concentrated all of its grey levels around 0. But why exactly does this aid compression?

Is there maybe a formula to determine the compression rate of Huffman, knowing the standard deviation and entropy of the original image? Otherwise, why would the compression ratio be any different; it’s not like the range of values has changed between the original image and pre-processed image.

Thank you in advance,

Liam.

My first coding steps: firefox plugin which saves URIs to text file [on hold]

I recently started coding and now i’m planing my first little project.

I want to develop a firefox plugin which basic functionality should be able to save the current visited url/uri in the .. format to a local text file. I would like to start this process by clicking a button.

Just begun planning and now I’m looking for the right key words for my further online research. It would be nice if you commit those keywords which could help with the development. I am currently learning Ruby and already do some shell scripting stuff but am also open for new languages.

What I’ve found out so far: Firefox provides an API that allows to access the URI/URL information of a currently visted website.

I don’t know how to write this information in a textfile and how to define when this process should get initiated.

please help me out 🙂