computation models – Cellular automaton that squares the input

Disclaimer: This is an exact copy of a post I made on Stack Overflow. A user brought my attention to CS Stack overflow. Since it is actually better suited here I thought I might ask it here as well. If answered I would link from SO to here of course.

Using a cellular automata, I would like to take a tape as an input containing I‘s is surrounded by an arbitrary amount of O‘s and square the number of I‘s: O O O O I I O O O -> O O O O I I I I O O O

Stephen Wolfram explains how a cellular automata can square the number of N inputs like this:

enter image description here

I have some problems with this. On one hand I don’t understand what p or eg. 7-p is supposed to be. Neither do I understand what the input state was. 1? 6? On the other hand I see from the images which correspond to the rules, that Wolframs output has some remaining helper symbols:
O O O O I I O O O -> O O O O X X I I I I O O O

So far my approach has been to handle it like a string rewriting system. I added markers at both ends and tried to move a courser back and forth to square the unitary number:

( ,O,I) ==> L
(I,O,O) ==> R
(L,I,I) ==> >
(>,I,I) ==> >
...

I managed to get a pass from left to right and copy one value over the R, but this took me already more than 20 of these lines. This looks way worse than Wolfram’s solution.

Probable “user error” with input parameters, C++; pointer inputs, “binary” conversion

I am trying to write a couple of template functions that convert back and forth between a value of any data type (within reason) bytewise into a character string.
The idea is to (eventually) store the values in a .bin file, and also to be able to recover the values from said .bin file.
However, I need to get the conversion functions correct, first.
Originally, I wrote a toy function that did both that looked line this:

template<typename T>
void buildabin(T x)
{
    char* X;
    T x_;
    X = (char*)&x;
    memcpy(&x_, X, sizeof(T));
    cout<<x_<<endl;
}

This seemed to work fine.
However, when I tried to separate out the two capabilities, using:

template<typename T>
void buildabin(char*& X, T x)
{
    X = (char*)&x;
}

And:

template<typename T>
void buildaT(char* X, T& x)
{
    memcpy(&x, X, sizeof(T));
}

It seems as if it is doing the conversion to the binary string correctly, however, upon input to “buildaT”, it barfs – after placing some couts for X in various places, for some strange reason, it is not getting even the address of X correctly.
And of course, “little” x just returns garbage.

I have tried every scheme I can to get this to work. It seems it’s a “user error” on my part with respect to input in the “buildaT” function, but I am stuck as to where the error lies.

Here is main, if that helps:

int main()
{
    //char* G = new char(sizeof(double)); //(tried this also)

    char* G = NULL;

    double g;

    cin>>g;

    buildabin<double>(G, g);

    double g_;

    buildaT<double>(G, g_);

    cout<<g_<<endl;


    return(0);
}

What block space savings would we get for coinjoins (and payjoins) if we had cross input signature aggregation?

What block space savings (specific numbers in weight units or vbytes) would we achieve for coinjoins (and payjoins) if we had cross input signature aggregation (post a speculative future soft fork that enabled it)?

This question was asked by Mario Gibney on Twitter and has been paraphrased.

wi fi – HDMI Input and charging dilemma

I’m needing to display an HDMI signal on an Android tablet. I can do it using an HDMI to USB capture dongle and the USB Camera Pro app, however I am unable to keep the tablet charged while it is receiving video/audio. I thought that an NDI video stream over WiFi might be an option but it seems there are no NDI decoders available yet for Android, only encoding apps.

Is there some other way that I can display HDMI on the tablet and maintain it charged?

The tablet in question is a Samsung Tab S2 (SM-T813).

Thank you

input – Why don’t my keypresses work in Pygame?

I don’t know why my attempt to read keypresses in Pygame is not working.

import pygame

pygame.init()
  
white = (255, 255, 255)
green = (0, 255, 0)
blue = (0, 0, 128)
black = (0, 0, 0)
red = (255, 0, 0)

w = 500
h = 500

x = 15
y = 480
vel = 5
screen = pygame.display.set_mode((w, h))

square = pygame.image.load(r'/Users/lanik2009/Downloads/square.PNG')
square = pygame.transform.scale(square, (46, 40))
triangle = pygame.image.load(r'/Users/lanik2009/Downloads/triangle.PNG')
triangle = pygame.transform.scale(triangle, (46, 40))

def player():
    screen.fill(black)
    pygame.draw.circle(screen,white, (15, 480), 10, 500)
    screen.blit(triangle, (80, 460))
    screen.blit(square, (180, 460))
        
running = True

while running:
      
    for event in pygame.event.get():
        if event.type == pygame.QUIT:
            running = False

    userInput = pygame.key.get_pressed()
    if userInput(pygame.K_LEFT):
        x = -vel
    if userInput(pygame.K_RIGHT):
        x = vel
    
    player()
    pygame.display.update() 

magento2 – How can i set input field on Magento 2 admin data grid in Magento 2.4?

magento2 – How can i set input field on Magento 2 admin data grid in Magento 2.4? – Magento Stack Exchange

python – Como criar uma lista pré=determinada no input

Galera preciso de uma ajuda, pois faz 2 dias que estou tentando fazer um programinha que calcule os dias da semana + os dias que o usuário digitar e dê a entrega, por exemplo:
Entrada:
terca
5
Saída:
será entregue domingo

já tentei criar uma lista com todos os dias e calcular mas nao foi, minha duvida é de como que eu faço pra uma string ser calculada como valor

dia = input()
compra = int(input())
prazo = dia + compra
if dia == ‘terca’:
print(‘sera entregue’,prazo)

formulas – I am getting input mismatch exception error continuously?

formulas – I am getting input mismatch exception error continuously? – Web Applications Stack Exchange

javascript – Estou pedindo para o meu site retornar a mesma data que eu coloquei no input e ele retorna o dia anterior da data

Eu estou fazendo um código no qual eu escrevo uma data, e ele me retorna a mesma data, só que ao retornar a mesma, ele está retornando a data com -1 dia…inserir a descrição da imagem aqui

Código:
.JS


function ContarDias() {
let inicio = new Date(document.datas.inicio.value);
let dia = new Number(document.datas.dia.value);
inicio.setDate(inicio.getDate());
let resultado = inicio.toLocaleDateString(“pt-BR”);
// if (dia == 0 || dia == null) {
// document.getElementById(‘dias’).innerText = “Error: Dias inválido !”;
// } else {
document.getElementById(‘dias’).innerText = resultado;
// }
}

DreamProxies - Cheapest USA Elite Private Proxies 100 Private Proxies 200 Private Proxies 400 Private Proxies 1000 Private Proxies 2000 Private Proxies ExtraProxies.com - Buy Cheap Private Proxies Buy 50 Private Proxies Buy 100 Private Proxies Buy 200 Private Proxies Buy 500 Private Proxies Buy 1000 Private Proxies Buy 2000 Private Proxies ProxiesLive Proxies-free.com New Proxy Lists Every Day Proxies123